Skip to content

Refactoring bytecode_module to use flatcc instead of flatbuffers C++. - #2568

Merged
benvanik merged 4 commits into
mainfrom
benvanik-flatcc-vm
Jul 28, 2020
Merged

benvanik merged 4 commits into
mainfrom
benvanik-flatcc-vm

Conversation

@benvanik

@benvanik benvanik commented Jul 18, 2020 •

Copy link
Copy Markdown
Collaborator

This improves our validation, removes manually-synchronized redundancy
with the schema for function descriptors, and optimizes a few things like
redundant type resolution.

Required a fix to cc_embed_data; the way it stores files as strings does not
guarantee alignment. The Flatbuffers C++ API papers over this and allows
for unaligned accesses, but flatcc doesn't (which is good); now all files
will be pointer-aligned.

Progress on #898.

@benvanik benvanik added runtime Relating to the IREE runtime library performance ⚡ Performance/optimization related work across the compiler and runtime labels Jul 18, 2020
@benvanik benvanik added this to the 2020Q3 Core milestone Jul 18, 2020
@benvanik
benvanik requested a review from ScottTodd July 18, 2020 17:54
@benvanik
benvanik force-pushed the benvanik-flatcc-vm branch 4 times, most recently from 5407c56 to 761ae00 Compare July 18, 2020 20:29
@benvanik
benvanik marked this pull request as ready for review July 18, 2020 20:29

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, once we've figured out how to add the flatcc dep. I'd prefer to sequence this change after the dependency is added and fully merged though.

@benvanik
benvanik force-pushed the benvanik-flatcc branch 3 times, most recently from 426875e to 2d1808b Compare July 21, 2020 01:21
@benvanik
benvanik force-pushed the benvanik-flatcc-vm branch from 761ae00 to 09279ed Compare July 21, 2020 01:22
benvanik added 3 commits July 20, 2020 18:48
This ensures they are correctly generated and included.
Future changes will switch to using them over the C++ API.
This improves our validation, removes manually-synchronized redundancy
with the schema for function descriptors, and optimizes a few things like
redundant type resolution.
@benvanik
benvanik force-pushed the benvanik-flatcc-vm branch from 09279ed to 8c18b8c Compare July 21, 2020 01:49
@benvanik
benvanik requested a review from ScottTodd July 21, 2020 02:02
This commit also defines iree_host_build_flatcc_cli when not
cross compiling so we can depend on it in iree_flatbuffer_c_library.

Also copy flatcc_cli from the proper place. They install it
in the source directory...

Co-authored-by: Lei Zhang <[email protected]>
Base automatically changed from benvanik-flatcc to main July 21, 2020 19:09
#include <stdint.h>
#include <string.h>

// TODO(benvanik): figure out how to make MSVC happy with C11 stdalign.h.

@antiagainst antiagainst Jul 21, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: This will also have problem with Android, where we don't have cstdalign in the NDK. stdalign.h is fine, at least with ndk-r21d.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5589fd2 is a possible fix to make it compile. Ben might want to see whether it makes sense though.

@ScottTodd

Copy link
Copy Markdown
Member

Code LGTM, once we've figured out how to add the flatcc dep. I'd prefer to sequence this change after the dependency is added and fully merged though.

Should be ready now.

@GMNGeoffrey

Copy link
Copy Markdown
Member

Can we go ahead and merge this? I'm waiting for some old PRs to get merged before I do more fiddling with the CI directory structure

@benvanik
benvanik merged commit c96bbb1 into main Jul 28, 2020
@benvanik
benvanik deleted the benvanik-flatcc-vm branch July 28, 2020 16:52
@antiagainst

Copy link
Copy Markdown
Member

This now breaks Android cross compilation.. Ben, have you checked 5589fd2 and see whether it make sense to have it as a patch?

@hanhanW hanhanW mentioned this pull request Jul 30, 2020
This was referenced Jul 30, 2020
copybara-service Bot pushed a commit that referenced this pull request Jul 31, 2020
* 6c1869b Add license header to linker scripts (#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (#2627)" (#2735)
* da48d03 Adds a class for tracing module calls and example tests. (#2660)
* d66150d Enables `conv_test` on vulkan. (#2723)
* a3b73bf Add .python-version to .gitignore (#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (#2725)
* 763dc09 Fix ModelBuilder build (#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (#2709)
* 91a05ff Merge google -> main (#2719)
* f0307a8 Revert "Merge google -> main" (#2718)
* 77d2f8b Merge google -> main (#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (#2536)" (#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (#2702)
* 48efada Dump input values to a file. (#2683)
* 0fd8a55 Mark shell scripts as executable (#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (#2687)
* 64e2987 Merge google -> main (#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (#2696)
* eec62a1 Remove dylib-llvm-aot tests (#2694)
* 11bd7a0 Fix stdalign include in Android (#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (#2685)
* f2d6649 Bump pybind11 to head. (#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (#2684)
* c96bbb1 Merge pull request #2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (#2577)
* 1425737 Fix flatcc target name and binary path (#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.

COPYBARA_INTEGRATE_REVIEW=#2700 from hanhanW:fix-google c20d6f5
PiperOrigin-RevId: 324296127
copybara-service Bot pushed a commit that referenced this pull request Jul 31, 2020
* 6c1869b Add license header to linker scripts (#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (#2627)" (#2735)
* da48d03 Adds a class for tracing module calls and example tests. (#2660)
* d66150d Enables `conv_test` on vulkan. (#2723)
* a3b73bf Add .python-version to .gitignore (#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (#2725)
* 763dc09 Fix ModelBuilder build (#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (#2709)
* 91a05ff Merge google -> main (#2719)
* f0307a8 Revert "Merge google -> main" (#2718)
* 77d2f8b Merge google -> main (#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (#2536)" (#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (#2702)
* 48efada Dump input values to a file. (#2683)
* 0fd8a55 Mark shell scripts as executable (#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (#2687)
* 64e2987 Merge google -> main (#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (#2696)
* eec62a1 Remove dylib-llvm-aot tests (#2694)
* 11bd7a0 Fix stdalign include in Android (#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (#2685)
* f2d6649 Bump pybind11 to head. (#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (#2684)
* c96bbb1 Merge pull request #2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (#2577)
* 1425737 Fix flatcc target name and binary path (#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.

COPYBARA_INTEGRATE_REVIEW=#2700 from hanhanW:fix-google c20d6f5
PiperOrigin-RevId: 324296127
GMNGeoffrey pushed a commit to GMNGeoffrey/iree that referenced this pull request Aug 3, 2020
* 6c1869b Add license header to linker scripts (iree-org#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (iree-org#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (iree-org#2627)" (iree-org#2735)
* da48d03 Adds a class for tracing module calls and example tests. (iree-org#2660)
* d66150d Enables `conv_test` on vulkan. (iree-org#2723)
* a3b73bf Add .python-version to .gitignore (iree-org#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (iree-org#2725)
* 763dc09 Fix ModelBuilder build (iree-org#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (iree-org#2709)
* 91a05ff Merge google -> main (iree-org#2719)
* f0307a8 Revert "Merge google -> main" (iree-org#2718)
* 77d2f8b Merge google -> main (iree-org#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (iree-org#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (iree-org#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (iree-org#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (iree-org#2536)" (iree-org#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (iree-org#2702)
* 48efada Dump input values to a file. (iree-org#2683)
* 0fd8a55 Mark shell scripts as executable (iree-org#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (iree-org#2687)
* 64e2987 Merge google -> main (iree-org#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (iree-org#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (iree-org#2696)
* eec62a1 Remove dylib-llvm-aot tests (iree-org#2694)
* 11bd7a0 Fix stdalign include in Android (iree-org#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (iree-org#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (iree-org#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (iree-org#2685)
* f2d6649 Bump pybind11 to head. (iree-org#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (iree-org#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (iree-org#2684)
* c96bbb1 Merge pull request iree-org#2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (iree-org#2577)
* 1425737 Fix flatcc target name and binary path (iree-org#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.

PiperOrigin-RevId: 324296127
GMNGeoffrey pushed a commit to GMNGeoffrey/iree that referenced this pull request Aug 3, 2020
* 6c1869b Add license header to linker scripts (iree-org#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (iree-org#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (iree-org#2627)" (iree-org#2735)
* da48d03 Adds a class for tracing module calls and example tests. (iree-org#2660)
* d66150d Enables `conv_test` on vulkan. (iree-org#2723)
* a3b73bf Add .python-version to .gitignore (iree-org#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (iree-org#2725)
* 763dc09 Fix ModelBuilder build (iree-org#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (iree-org#2709)
* 91a05ff Merge google -> main (iree-org#2719)
* f0307a8 Revert "Merge google -> main" (iree-org#2718)
* 77d2f8b Merge google -> main (iree-org#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (iree-org#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (iree-org#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (iree-org#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (iree-org#2536)" (iree-org#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (iree-org#2702)
* 48efada Dump input values to a file. (iree-org#2683)
* 0fd8a55 Mark shell scripts as executable (iree-org#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (iree-org#2687)
* 64e2987 Merge google -> main (iree-org#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (iree-org#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (iree-org#2696)
* eec62a1 Remove dylib-llvm-aot tests (iree-org#2694)
* 11bd7a0 Fix stdalign include in Android (iree-org#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (iree-org#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (iree-org#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (iree-org#2685)
* f2d6649 Bump pybind11 to head. (iree-org#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (iree-org#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (iree-org#2684)
* c96bbb1 Merge pull request iree-org#2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (iree-org#2577)
* 1425737 Fix flatcc target name and binary path (iree-org#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.
GMNGeoffrey pushed a commit to GMNGeoffrey/iree that referenced this pull request Aug 3, 2020
* 6c1869b Add license header to linker scripts (iree-org#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (iree-org#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (iree-org#2627)" (iree-org#2735)
* da48d03 Adds a class for tracing module calls and example tests. (iree-org#2660)
* d66150d Enables `conv_test` on vulkan. (iree-org#2723)
* a3b73bf Add .python-version to .gitignore (iree-org#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (iree-org#2725)
* 763dc09 Fix ModelBuilder build (iree-org#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (iree-org#2709)
* 91a05ff Merge google -> main (iree-org#2719)
* f0307a8 Revert "Merge google -> main" (iree-org#2718)
* 77d2f8b Merge google -> main (iree-org#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (iree-org#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (iree-org#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (iree-org#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (iree-org#2536)" (iree-org#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (iree-org#2702)
* 48efada Dump input values to a file. (iree-org#2683)
* 0fd8a55 Mark shell scripts as executable (iree-org#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (iree-org#2687)
* 64e2987 Merge google -> main (iree-org#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (iree-org#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (iree-org#2696)
* eec62a1 Remove dylib-llvm-aot tests (iree-org#2694)
* 11bd7a0 Fix stdalign include in Android (iree-org#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (iree-org#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (iree-org#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (iree-org#2685)
* f2d6649 Bump pybind11 to head. (iree-org#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (iree-org#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (iree-org#2684)
* c96bbb1 Merge pull request iree-org#2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (iree-org#2577)
* 1425737 Fix flatcc target name and binary path (iree-org#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.

PiperOriginRevId: 324296127
GMNGeoffrey pushed a commit to GMNGeoffrey/iree that referenced this pull request Aug 3, 2020
* 6c1869b Add license header to linker scripts (iree-org#2724)
* 6d32fe8 Updates all e2e tests to use TracedModuleTestCase (iree-org#2736)
* 7fea2dd Revert "[android] Ignore adb push status for the executable (iree-org#2627)" (iree-org#2735)
* da48d03 Adds a class for tracing module calls and example tests. (iree-org#2660)
* d66150d Enables `conv_test` on vulkan. (iree-org#2723)
* a3b73bf Add .python-version to .gitignore (iree-org#2727)
* 6d2bfd3 Enables passing MobileNet and MobileNetV2 vision tests (iree-org#2725)
* 763dc09 Fix ModelBuilder build (iree-org#2726)
* 528a86a Update the codegen pipeline example snippets to better demonstrate (iree-org#2709)
* 91a05ff Merge google -> main (iree-org#2719)
* f0307a8 Revert "Merge google -> main" (iree-org#2718)
* 77d2f8b Merge google -> main (iree-org#2711)
* aafabbc Add linker scripts to cmake pyiree builds to hide symbols. (iree-org#2707)
* 1918d5c Updated gather to run on LLVM and SPIRV (iree-org#2701)
* ec38aa0 Add a VM to EmitC conversion and CModule Target (iree-org#2536)
* 32fe2c9 Revert "Add a VM to EmitC conversion and CModule Target (iree-org#2536)" (iree-org#2703)
* e7f90b6 Revert addition of DYLIB-LLVM-AOT as a default backend (iree-org#2702)
* 48efada Dump input values to a file. (iree-org#2683)
* 0fd8a55 Mark shell scripts as executable (iree-org#2699)
* 966fe78 Add dep "//iree/base:localfile" to iree-run-mlir (iree-org#2687)
* 64e2987 Merge google -> main (iree-org#2698)
* ced7477 Update scripts for packaging wheels from bazel.
* 1c05e0a Disable dylib driver for android build (iree-org#2692)
* e00a85f Disable a few gcc warnings that are chatty.
* 74af1f0 Add a config for gcc. (iree-org#2696)
* eec62a1 Remove dylib-llvm-aot tests (iree-org#2694)
* 11bd7a0 Fix stdalign include in Android (iree-org#2688)
* b9026bd Enable dylib-llvm-aot backend e2e/xla_op tests (iree-org#2639)
* 8ed9f73 Added Complex operation lowerings to pre-target conversion (iree-org#2662)
* 8224247 Working around duplicate func->llvm.func rewrites. (iree-org#2685)
* f2d6649 Bump pybind11 to head. (iree-org#2592)
* 9ac5241 [NFC] Remove empty ArrayRef<NamedAttribute> arg in op creation (iree-org#2686)
* 36abdfd [ModelBuilder] Revert spurious path change (iree-org#2684)
* c96bbb1 Merge pull request iree-org#2568 from google/benvanik-flatcc-vm
* f80864f [ModelBuilder] Add MemRefUtil helpers for padding. (iree-org#2577)
* 1425737 Fix flatcc target name and binary path (iree-org#2599)
* 8c18b8c Refactoring bytecode_module to use flatcc instead of flatbuffers C++. This imp..
* 3762c13 Linking in the flatcc bytecode_module_def files. This ensures they are correct..
* eb53de3 Building bytecode_module_def with flatcc.

PiperOrigin-RevId: 324296127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance ⚡ Performance/optimization related work across the compiler and runtime runtime Relating to the IREE runtime library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants