migrate XLA optimization from tf2.15 to 2.20#6
Open
wendi98 wants to merge 3 commits intojoeyye-work:for-serving-2.20from
Open
migrate XLA optimization from tf2.15 to 2.20#6wendi98 wants to merge 3 commits intojoeyye-work:for-serving-2.20from
wendi98 wants to merge 3 commits intojoeyye-work:for-serving-2.20from
Conversation
8305a86 to
e5dedb2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebuild the tensorflow server
If you do not want to build libblas_mlir.so and only want to use the OpenBLAS interface, use this command or set ENABLE_BLAS_MLIR to false.
bazel --output_user_root=./output build -c opt --distdir=/XXX/serving/downloads tensorflow_serving/model_servers:tensorflow_model_server --jobs 64 2>&1 | tee build.logWhen the ENABLE_BLAS_MLIR variable is set to true, you can use self-developed interfaces with mlir, such as __xla_cpu_runtime_KernelSelectorGEMVMLIR.
bazel --output_user_root=./output build -c opt --define ENABLE_BLAS_MLIR=true --distdir=/XXX/serving/downloads tensorflow_serving/model_servers:tensorflow_model_server --jobs 64 2>&1 | tee build.logEnable the self-developed optimizations
export SET_CPU_INS_FUSION_NOT_DUPLICATE = "1"
XLA_FLAGS="--xla_cpu_enable_xnnpack=true --xla_cpu_use_kernel_selector=true "
XLA_FLAGS+="--xla_cpu_use_thunk_runtime=false --xla_cpu_use_fusion_emitters=false"
export XLA_FLAGS
export OMP_NUM_THREADS=1
export KERNEL_MAP_FILE="kernels_map.txt"
Create a new kernels_map.txt file in the directory where the script is located, and the content of the file is as follows:
For scenarios where intra is greater than 1, parallel kernels can be used: