File tree Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Expand file tree Collapse file tree 2 files changed +17
-8
lines changed Original file line number Diff line number Diff line change
1
+ # Ensure the ${model} is available at ${final_path}.
2
+ #
3
+ function (tfgetmodel model final_path )
4
+ if (IS_ABSOLUTE ${model} )
5
+ set (${final_path} ${model} PARENT_SCOPE )
6
+ else ()
7
+ set (${final_path}
8
+ ${CMAKE_CURRENT_SOURCE_DIR} /${model} PARENT_SCOPE )
9
+ endif ()
10
+ endfunction ()
11
+
1
12
# Run the tensorflow compiler (saved_model_cli) on the saved model in the
2
13
# ${model} directory, looking for the ${tag_set} tag set, and the SignatureDef
3
14
# ${signature_def_key}.
4
15
# Produce a pair of files called ${fname}.h and ${fname}.o in the
5
16
# ${CMAKE_CURRENT_BINARY_DIR}. The generated header will define a C++ class
6
17
# called ${cpp_class} - which may be a namespace-qualified class name.
7
18
function (tfcompile model tag_set signature_def_key fname cpp_class )
8
- if (IS_ABSOLUTE ${model} )
9
- set (LLVM_ML_MODELS_ABSOLUTE ${model} )
10
- else ()
11
- set (LLVM_ML_MODELS_ABSOLUTE
12
- ${CMAKE_CURRENT_SOURCE_DIR} /${model} )
13
- endif ()
14
-
19
+ tfgetmodel (${model} LLVM_ML_MODELS_ABSOLUTE )
20
+ message ("Using model at " ${LLVM_ML_MODELS_ABSOLUTE} )
15
21
set (prefix ${CMAKE_CURRENT_BINARY_DIR} /${fname} )
16
22
set (obj_file ${prefix} .o )
17
23
set (hdr_file ${prefix} .h )
Original file line number Diff line number Diff line change 1
1
if (DEFINED LLVM_HAVE_TF_AOT OR DEFINED LLVM_HAVE_TF_API )
2
2
if (DEFINED LLVM_HAVE_TF_AOT )
3
+ set (LLVM_INLINER_MODEL_PATH "models/inliner"
4
+ CACHE STRING
5
+ "ML-driven inliner policy location (path to saved model)" )
3
6
include (TensorFlowCompile )
4
- tfcompile (models/inliner serve action InlinerSizeModel llvm::InlinerSizeModel )
7
+ tfcompile (${LLVM_INLINER_MODEL_PATH} serve action InlinerSizeModel llvm::InlinerSizeModel )
5
8
list (APPEND GeneratedMLSources
6
9
$< TARGET_OBJECTS:tf_xla_runtime_objects>
7
10
${GENERATED_OBJS}
You can’t perform that action at this time.
0 commit comments