Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit d7c1d89

Browse files
XLA AUTO JIT made non default
1 parent 74ab36f commit d7c1d89

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

tftrt/examples/image_classification/scripts/base_script.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ MODEL_DIR=""
1111
NVIDIA_TF32_OVERRIDE=""
1212

1313
BYPASS_ARGUMENTS=""
14+
TF_AUTO_JIT_XLA_FLAG=""
1415

1516
# Loop through arguments and process them
1617
for arg in "$@"
@@ -38,6 +39,10 @@ do
3839
--output_tensor_indices=*)
3940
shift # Remove --output_tensor_indices= from processing
4041
;;
42+
--use_xla_auto_jit)
43+
TF_AUTO_JIT_XLA_FLAG="TF_XLA_FLAGS=--tf_xla_auto_jit=2"
44+
shift # Remove --use_xla_auto_jit from processing
45+
;;
4146
*)
4247
BYPASS_ARGUMENTS=" ${BYPASS_ARGUMENTS} ${arg}"
4348
;;
@@ -104,6 +109,7 @@ echo "[*] NUM_CLASSES: ${NUM_CLASSES}"
104109
echo "[*] OUTPUT_TENSOR_IDX_FLAG: ${OUTPUT_TENSOR_IDX_FLAG}"
105110
echo "[*] OUTPUT_TENSOR_NAME_FLAG: ${OUTPUT_TENSOR_NAME_FLAG}"
106111
echo ""
112+
echo "[*] TF_AUTO_JIT_XLA_FLAG: ${TF_AUTO_JIT_XLA_FLAG}"
107113
echo "[*] BYPASS_ARGUMENTS: $(echo \"${BYPASS_ARGUMENTS}\" | tr -s ' ')"
108114
echo -e "********************************************************************\n"
109115

@@ -147,7 +153,7 @@ cd ${BENCH_DIR}
147153

148154
# Execute the example
149155

150-
PREPEND_COMMAND="TF_XLA_FLAGS=--tf_xla_auto_jit=2 ${NVIDIA_TF32_OVERRIDE}"
156+
PREPEND_COMMAND="${TF_AUTO_JIT_XLA_FLAG} ${NVIDIA_TF32_OVERRIDE}"
151157

152158
COMMAND="${PREPEND_COMMAND} python image_classification.py \
153159
--data_dir ${DATA_DIR} \

tftrt/examples/object_detection/scripts/base_script.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ MAX_WORKSPACE_SIZE=$((2 ** (32 + 1))) # + 1 necessary compared to python
1515
INPUT_SIZE=640
1616

1717
BYPASS_ARGUMENTS=""
18+
TF_AUTO_JIT_XLA_FLAG=""
1819

1920
# Loop through arguments and process them
2021
for arg in "$@"
@@ -40,6 +41,10 @@ do
4041
MODEL_DIR="${arg#*=}"
4142
shift # Remove --input_saved_model_dir= from processing
4243
;;
44+
--use_xla_auto_jit)
45+
TF_AUTO_JIT_XLA_FLAG="TF_XLA_FLAGS=--tf_xla_auto_jit=2"
46+
shift # Remove --use_xla_auto_jit from processing
47+
;;
4348
*)
4449
BYPASS_ARGUMENTS=" ${BYPASS_ARGUMENTS} ${arg}"
4550
;;
@@ -69,6 +74,7 @@ echo "[*] BATCH_SIZE: ${BATCH_SIZE}"
6974
echo "[*] INPUT_SIZE: ${INPUT_SIZE}"
7075
echo "[*] MAX_WORKSPACE_SIZE: ${MAX_WORKSPACE_SIZE}"
7176
echo ""
77+
echo "[*] TF_AUTO_JIT_XLA_FLAG: ${TF_AUTO_JIT_XLA_FLAG}"
7278
echo "[*] BYPASS_ARGUMENTS: $(echo \"${BYPASS_ARGUMENTS}\" | tr -s ' ')"
7379
echo -e "********************************************************************\n"
7480

@@ -133,7 +139,7 @@ fi
133139

134140
# Step 2: Execute the example
135141

136-
PREPEND_COMMAND="TF_XLA_FLAGS=--tf_xla_auto_jit=2 ${NVIDIA_TF32_OVERRIDE}"
142+
PREPEND_COMMAND="${TF_AUTO_JIT_XLA_FLAG} ${NVIDIA_TF32_OVERRIDE}"
137143

138144
COMMAND="${PREPEND_COMMAND} python object_detection.py \
139145
--data_dir ${VAL_DATA_DIR} \

tftrt/examples/transformers/scripts/base_script.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NVIDIA_TF32_OVERRIDE=""
1313
DATA_DIR="/tmp"
1414

1515
BYPASS_ARGUMENTS=""
16+
TF_AUTO_JIT_XLA_FLAG=""
1617

1718
# Loop through arguments and process them
1819
for arg in "$@"
@@ -39,6 +40,10 @@ do
3940
MODEL_DIR="${arg#*=}"
4041
shift # Remove --input_saved_model_dir= from processing
4142
;;
43+
--use_xla_auto_jit)
44+
TF_AUTO_JIT_XLA_FLAG="TF_XLA_FLAGS=--tf_xla_auto_jit=2"
45+
shift # Remove --use_xla_auto_jit from processing
46+
;;
4247
*)
4348
BYPASS_ARGUMENTS=" ${BYPASS_ARGUMENTS} ${arg}"
4449
;;
@@ -79,6 +84,7 @@ echo ""
7984
echo "[*] MIN_SEGMENT_SIZE: ${MIN_SEGMENT_SIZE}"
8085
echo "[*] VOCAB_SIZE: ${VOCAB_SIZE}"
8186
echo ""
87+
echo "[*] TF_AUTO_JIT_XLA_FLAG: ${TF_AUTO_JIT_XLA_FLAG}"
8288
echo "[*] BYPASS_ARGUMENTS: $(echo \"${BYPASS_ARGUMENTS}\" | tr -s ' ')"
8389

8490
echo -e "********************************************************************\n"
@@ -123,7 +129,7 @@ cd ${BENCH_DIR}
123129

124130
# Execute the example
125131

126-
PREPEND_COMMAND="TF_XLA_FLAGS=--tf_xla_auto_jit=2 ${NVIDIA_TF32_OVERRIDE}"
132+
PREPEND_COMMAND="${TF_AUTO_JIT_XLA_FLAG} ${NVIDIA_TF32_OVERRIDE}"
127133

128134
COMMAND="${PREPEND_COMMAND} python transformers.py \
129135
--input_saved_model_dir ${INPUT_SAVED_MODEL_DIR} \

0 commit comments

Comments
 (0)