Skip to content

[TIR] Ignore None-valued pragma annotations - #20265

Open
StrongbodyStrongmind wants to merge 1 commit into
apache:mainfrom
StrongbodyStrongmind:fix-18393-latest
Open

[TIR] Ignore None-valued pragma annotations#20265
StrongbodyStrongmind wants to merge 1 commit into
apache:mainfrom
StrongbodyStrongmind:fix-18393-latest

Conversation

@StrongbodyStrongmind

Copy link
Copy Markdown

Fixes #18393.

None-valued pragma annotations represent an unspecified pragma and should not be lowered into AttrStmt nodes with undefined PrimExpr values.

Previously, pragma_unroll_explicit=None was lowered into an AttrStmt with an undefined value. During FlattenBuffer, StmtExprMutator attempted to visit that value and triggered a segmentation fault.

This patch skips None-valued pragma annotations during opaque lowering while preserving the existing behavior for valid pragma values.

For pragma_unroll, the existing upstream behavior is preserved: non-null values remain attached to the loop, while null values are ignored.

Tests:

  • tests/python/tirx-transform/test_tir_transform_flatten_buffer.py: 11 passed
  • tests/python/s_tir/transform/test_s_tir_transform_lower_opaque_block.py: 13 passed
  • git diff --check upstream/main..HEAD: passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Segfault in TVM when building TIR module with pragma_unroll_explicit annotations

1 participant