Skip to content

Commit 11085e1

Browse files
Merge pull request #4445 from AI-Hypercomputer:fix/generate-new-hlo
PiperOrigin-RevId: 949185878
2 parents c5b135a + ec4741f commit 11085e1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/integration/hlo_diff_test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,21 @@
4343
# Filters and normalizes an HLO line to ignore environment-specific details.
4444
STACK_FRAME_REGEX = re.compile(r"stack_frame_id=\d+")
4545

46+
# The serialized Mosaic kernel of a Pallas custom call embeds the absolute path of the installed
47+
# jax package, so it differs between a venv install and a Docker image install even though the
48+
# compiled graph is the same. The kernel's shapes and block sizes are still checked, since they
49+
# appear as plain text elsewhere in the dump.
50+
CUSTOM_CALL_BODY_REGEX = re.compile(r'("custom_call_config":\{"body":")[^"]*(")')
51+
4652

4753
def filter_line(line):
4854
# Matches operation sections content like: 1234 {"sharding parameters", ...} or 1234 "operation metadata"
4955
if SECTION_CONTENT_REGEX.match(line):
5056
return None
5157
# Replace stack_frame_id=... with stack_frame_id=0
5258
line = STACK_FRAME_REGEX.sub("stack_frame_id=0", line)
59+
# Replace the serialized Mosaic kernel with a placeholder
60+
line = CUSTOM_CALL_BODY_REGEX.sub(r"\1<mosaic_body>\2", line)
5361
return line
5462

5563

0 commit comments

Comments
 (0)