Set FLATBUFFERS_MAX_ALIGNMENT=1024 (#4215)
Summary: I noticed a [build failure](https://github.com/pytorch/executorch/actions/runs/9883069353/job/27297116628#step:12:12476) during a flatc execution step, complaining about a `force_align` value that was larger than FLATBUFFERS_MAX_ALIGNMENT (default 32): ``` Exported ModuleAddMul and wrote program data to cmake-out/ModuleAddMul.pte Exported ModuleAddMul and wrote program data to cmake-out/ModuleAddMul-da1024.pte Exported ModuleAddMul and wrote program data to cmake-out/ModuleAddMul-nosegments.pte error: /tmp/tmpslmqnrmb/data.json:1: 2248: error: unexpected force_align value '1024', alignment must be a power of two integer ranging from the type's natural alignment 1 to 32 ``` The error message is printed by https://github.com/google/flatbuffers/blob/fb9afbafc7dfe226b9db54d4923bfb8839635274/src/idl_parser.cpp#L1694 exir lets users set the alignment of tensor data embedded in the flatbuffer, and some users need an alignment larger than the default. So, increase the default to a "large" power of 2 when building `flatc` and when building the runtime. Pull Request resolved: https://github.com/pytorch/executorch/pull/4215 Test Plan: CI jobs pass. I looked at the makefiles generated by cmake, and verified that FLATBUFFERS_MAX_ALIGNMENT is only being set while building `flatc` and `executorch_no_prim_ops`: ``` find . -name flags.make | xargs grep MAX_ALIGNMENT ./CMakeFiles/executorch_no_prim_ops.dir/flags.make:CXX_DEFINES = -DET_ENABLE_PROGRAM_VERIFICATION=0 -DET_MIN_LOG_LEVEL=Info -DFLATBUFFERS_MAX_ALIGNMENT=1024 ./third-party/flatbuffers/CMakeFiles/flatc.dir/flags.make:CXX_DEFINES = -DET_ENABLE_PROGRAM_VERIFICATION=0 -DET_MIN_LOG_LEVEL=Info -DFLATBUFFERS_LOCALE_INDEPENDENT=0 -DFLATBUFFERS_MAX_ALIGNMENT=1024 ``` Reviewed By: tarun292 Differential Revision: D59645222 Pulled By: dbort fbshipit-source-id: e692ead83d08757c067a9d636853614ea3eb2eca
D
Dave Bort committed
69dcfe0750405a57cf10e09da7c65ce5970247c6
Parent: 56120f9
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 7/24/2024, 6:15:21 PM