Skip to content

Commit 24fbc70

Browse files
committed
Rename c_output to c_identifier and set for embedded bytecode modules.
1 parent 6af6162 commit 24fbc70

30 files changed

Lines changed: 74 additions & 51 deletions

‎bindings/tflite/smoke_test.cc‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ limitations under the License.
3535
// embedding the module directly in a binary.
3636
#include "bindings/tflite/testdata/add_dynamic_c.h"
3737
#define IREE_BINDINGS_TFLITE_TESTDATA_ADD_DYNAMIC_EMBEDDED_DATA \
38-
add_dynamic_c_create()->data
38+
iree_tflite_testdata_add_dynamic_create()->data
3939
#define IREE_BINDINGS_TFLITE_TESTDATA_ADD_DYNAMIC_EMBEDDED_SIZE \
40-
add_dynamic_c_create()->size
40+
iree_tflite_testdata_add_dynamic_create()->size
4141
#include "bindings/tflite/testdata/add_static_c.h"
4242
#define IREE_BINDINGS_TFLITE_TESTDATA_ADD_STATIC_EMBEDDED_DATA \
43-
add_static_c_create()->data
43+
iree_tflite_testdata_add_static_create()->data
4444
#define IREE_BINDINGS_TFLITE_TESTDATA_ADD_STATIC_EMBEDDED_SIZE \
45-
add_static_c_create()->size
45+
iree_tflite_testdata_add_static_create()->size
4646

4747
// TODO(#3971): currently can't nicely load these due to cmake issues.
4848
#define IREE_BINDINGS_TFLITE_TESTDATA_ADD_STATIC_PATH \

‎bindings/tflite/testdata/BUILD‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ iree_bytecode_module(
2424
name = "add_dynamic",
2525
testonly = True,
2626
src = "add_dynamic.mlir",
27-
c_output = True,
27+
c_identifier = "iree_tflite_testdata_add_dynamic",
2828
flags = [
2929
"-iree-native-bindings-support=false",
3030
"-iree-tflite-bindings-support",
@@ -37,7 +37,7 @@ iree_bytecode_module(
3737
name = "add_multi",
3838
testonly = True,
3939
src = "add_multi.mlir",
40-
c_output = True,
40+
c_identifier = "iree_tflite_testdata_add_multi",
4141
flags = [
4242
"-iree-native-bindings-support=false",
4343
"-iree-tflite-bindings-support",
@@ -50,7 +50,7 @@ iree_bytecode_module(
5050
name = "add_static",
5151
testonly = True,
5252
src = "add_static.mlir",
53-
c_output = True,
53+
c_identifier = "iree_tflite_testdata_add_static",
5454
flags = [
5555
"-iree-native-bindings-support=false",
5656
"-iree-tflite-bindings-support",

‎bindings/tflite/testdata/CMakeLists.txt‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ iree_bytecode_module(
2323
add_dynamic
2424
SRC
2525
"add_dynamic.mlir"
26-
C_OUTPUT
26+
C_IDENTIFIER
27+
"iree_tflite_testdata_add_dynamic"
2728
FLAGS
2829
"-iree-native-bindings-support=false"
2930
"-iree-tflite-bindings-support"
@@ -38,7 +39,8 @@ iree_bytecode_module(
3839
add_multi
3940
SRC
4041
"add_multi.mlir"
41-
C_OUTPUT
42+
C_IDENTIFIER
43+
"iree_tflite_testdata_add_multi"
4244
FLAGS
4345
"-iree-native-bindings-support=false"
4446
"-iree-tflite-bindings-support"
@@ -53,7 +55,8 @@ iree_bytecode_module(
5355
add_static
5456
SRC
5557
"add_static.mlir"
56-
C_OUTPUT
58+
C_IDENTIFIER
59+
"iree_tflite_testdata_add_static"
5760
FLAGS
5861
"-iree-native-bindings-support=false"
5962
"-iree-tflite-bindings-support"

‎build_tools/bazel_to_cmake/bazel_to_cmake_converter.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,19 +469,19 @@ def iree_bytecode_module(self,
469469
src,
470470
flags=None,
471471
translate_tool=None,
472-
c_output=None,
472+
c_identifier=None,
473473
testonly=None):
474474
name_block = _convert_string_arg_block("NAME", name, quote=False)
475475
src_block = _convert_string_arg_block("SRC", src)
476-
c_output_block = _convert_option_block("C_OUTPUT", c_output)
476+
c_identifier_block = _convert_string_arg_block("C_IDENTIFIER", c_identifier)
477477
translate_tool_block = _convert_translate_tool_block(translate_tool)
478478
flags_block = _convert_string_list_block("FLAGS", flags)
479479
testonly_block = _convert_option_block("TESTONLY", testonly)
480480

481481
self.converter.body += (f"iree_bytecode_module(\n"
482482
f"{name_block}"
483483
f"{src_block}"
484-
f"{c_output_block}"
484+
f"{c_identifier_block}"
485485
f"{translate_tool_block}"
486486
f"{flags_block}"
487487
f"{testonly_block}"

‎build_tools/cmake/iree_bytecode_module.cmake‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ include(CMakeParseArguments)
2525
# default flag set is "-iree-mlir-to-vm-bytecode-module".
2626
# TRANSLATE_TOOL: Translation tool to invoke (CMake target). The default
2727
# tool is "iree-translate".
28-
# C_OUTPUT: Control flag to generate c embed code.
28+
# C_IDENTIFIER: Identifier to use for generate c embed code.
29+
# If omitted then no C embed code will be generated.
2930
# PUBLIC: Add this so that this library will be exported under ${PACKAGE}::
3031
# Also in IDE, target will appear in ${PACKAGE} folder while non PUBLIC
3132
# will be in ${PACKAGE}/internal.
@@ -39,8 +40,8 @@ include(CMakeParseArguments)
3940
function(iree_bytecode_module)
4041
cmake_parse_arguments(
4142
_RULE
42-
"PUBLIC;TESTONLY;C_OUTPUT"
43-
"NAME;SRC;TRANSLATE_TOOL"
43+
"PUBLIC;TESTONLY"
44+
"NAME;SRC;TRANSLATE_TOOL;C_IDENTIFIER"
4445
"FLAGS"
4546
${ARGN}
4647
)
@@ -85,12 +86,12 @@ function(iree_bytecode_module)
8586
set(_PUBLIC_ARG "PUBLIC")
8687
endif()
8788

88-
if(_RULE_C_OUTPUT)
89+
if(_RULE_C_IDENTIFIER)
8990
iree_c_embed_data(
9091
NAME
9192
"${_RULE_NAME}_c"
9293
IDENTIFIER
93-
"${_RULE_NAME}_c"
94+
"${_RULE_C_IDENTIFIER}"
9495
GENERATED_SRCS
9596
"${_RULE_NAME}.vmfb"
9697
C_FILE_OUTPUT

‎experimental/bindings/java/com/google/iree/tests/CMakeLists.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ if(${IREE_BUILD_COMPILER})
1818
simple_mul_bytecode_module
1919
SRC
2020
"simple_mul.mlir"
21-
C_OUTPUT
21+
C_IDENTIFIER
22+
"iree_java_testdata_simple_mul_bytecode_module"
2223
FLAGS
2324
"-iree-mlir-to-vm-bytecode-module"
2425
"-iree-hal-target-backends=vmla"

‎experimental/bindings/java/com/google/iree/tests/integration_test.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extern "C" int main(int argc, char** argv) {
3636

3737
auto module = std::make_unique<ModuleWrapper>();
3838
const struct iree_file_toc_t* module_file =
39-
simple_mul_bytecode_module_c_create();
39+
iree_java_testdata_simple_mul_bytecode_module_create();
4040
auto module_status = module->Create(
4141
reinterpret_cast<const uint8_t*>(module_file->data), module_file->size);
4242
if (!module_status.ok()) {

‎iree/modules/strings/BUILD‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ iree_bytecode_module(
6464
name = "strings_module_test_module",
6565
testonly = True,
6666
src = "strings_module_test.mlir",
67-
c_output = True,
67+
c_identifier = "iree_strings_module_test_module",
6868
flags = [
6969
"-iree-mlir-to-vm-bytecode-module",
7070
"-iree-hal-target-backends=dylib-llvm-aot",

‎iree/modules/strings/CMakeLists.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ iree_bytecode_module(
6363
strings_module_test_module
6464
SRC
6565
"strings_module_test.mlir"
66-
C_OUTPUT
66+
C_IDENTIFIER
67+
"iree_strings_module_test_module"
6768
FLAGS
6869
"-iree-mlir-to-vm-bytecode-module"
6970
"-iree-hal-target-backends=dylib-llvm-aot"

‎iree/modules/strings/strings_module_test.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class StringsModuleTest : public ::testing::Test {
6868
iree_hal_driver_release(hal_driver);
6969

7070
// Setup the test module.
71-
const auto* module_file_toc = strings_module_test_module_c_create();
71+
const auto* module_file_toc = iree_strings_module_test_module_create();
7272
IREE_CHECK_OK(iree_vm_bytecode_module_create(
7373
iree_const_byte_span_t{
7474
reinterpret_cast<const uint8_t*>(module_file_toc->data),

0 commit comments

Comments
 (0)