S390X: fix detection of magic number placeholder in inductor (#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 https://github.com/pytorch/pytorch/pull/150116

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157784
Approved by: https://github.com/huydhn
This commit is contained in:
Aleksei Nikiforov 2025-08-04 12:42:27 +00:00 committed by PyTorch MergeBot
parent f74da2a136
commit 6646461764
2 changed files with 5 additions and 2 deletions

View File

@ -182,7 +182,6 @@ S390X_BLOCKLIST = [
"dynamo/test_misc",
"inductor/test_cpu_repro",
"inductor/test_cpu_select_algorithm",
"inductor/test_aot_inductor_arrayref",
"inductor/test_torchinductor_codegen_dynamic_shapes",
"lazy/test_meta_kernel",
"onnx/test_utility_funs",

View File

@ -2003,7 +2003,11 @@ end
f.seek(0)
hdr = f.read(1024)
# Search for magic number and write the actual data over it
start_idx = hdr.find(b"\xef\xcd\xab\x99\x78\x56\x34\x12")
start_idx = (
hdr.find(b"\xef\xcd\xab\x99\x78\x56\x34\x12")
if sys.byteorder == "little"
else hdr.find(b"\x12\x34\x56\x78\x99\xab\xcd\xef")
)
assert start_idx != -1
f.seek(start_idx)
pos = 0