Skip to content

Commit 6646461

Browse files
S390X: fix detection of magic number placeholder in inductor (pytorch#157784)
This change fixes multiple tests in test/inductor/test_aot_inductor_arrayref.py such as test_cond_with_parameters_cpu_with_stack_allocation, test_issue_140766_cpu_with_stack_allocation, test_model_modified_weights_cpu_with_stack_allocation, test_nested_tensor_from_jagged_cpu_with_stack_allocation. Enable tests in test/inductor/test_aot_inductor_arrayref.py This change is split off from pytorch#150116 Pull Request resolved: pytorch#157784 Approved by: https://github.com/huydhn
1 parent f74da2a commit 6646461

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/run_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ def __contains__(self, item):
182182
"dynamo/test_misc",
183183
"inductor/test_cpu_repro",
184184
"inductor/test_cpu_select_algorithm",
185-
"inductor/test_aot_inductor_arrayref",
186185
"inductor/test_torchinductor_codegen_dynamic_shapes",
187186
"lazy/test_meta_kernel",
188187
"onnx/test_utility_funs",

torch/_inductor/codecache.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,11 @@ def get_zero_consts_asm_code(
20032003
f.seek(0)
20042004
hdr = f.read(1024)
20052005
# Search for magic number and write the actual data over it
2006-
start_idx = hdr.find(b"\xef\xcd\xab\x99\x78\x56\x34\x12")
2006+
start_idx = (
2007+
hdr.find(b"\xef\xcd\xab\x99\x78\x56\x34\x12")
2008+
if sys.byteorder == "little"
2009+
else hdr.find(b"\x12\x34\x56\x78\x99\xab\xcd\xef")
2010+
)
20072011
assert start_idx != -1
20082012
f.seek(start_idx)
20092013
pos = 0

0 commit comments

Comments
 (0)