[REFACTOR][IR] Simplify CallingConv attribute access#19799
Conversation
CallingConv already has integral enum support in the FFI layer, so call sites can read and write the calling convention attribute without manually round-tripping through integer casts.
There was a problem hiding this comment.
Code Review
This pull request refactors the retrieval and comparison of calling conventions (CallingConv) across various backend codegens and TIR transform passes, replacing int64_t casts with direct CallingConv enum types. The review feedback suggests improving error handling in the Metal, OpenCL, Vulkan, and WebGPU codegens by explicitly checking if the calling convention attribute is present before comparing its value, which would provide more specific and informative error messages.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Backend codegen requires an explicit device-kernel calling convention. Split the checks so missing attributes and unexpected CallingConv values produce distinct diagnostics while keeping enum-based attribute access.
|
@tvm-bot rerun |
CallingConv already participates in TVM FFI integral enum conversion, so keeping call sites on manual integer casts adds noise without changing behavior. This was not possible before the TVM FFI Any support but now we natively support enum class int value conversion with Any, so we can simplify the codepath Main changes: - Read `tvm::attr::kCallingConv` as `CallingConv` directly - Compare optional/defaulted values against `CallingConv` enum values - Store CallingConv enum values directly where the cleanup touches attr writes
Summary
CallingConv already participates in TVM FFI integral enum conversion, so keeping call sites on manual integer casts adds noise without changing behavior. This was not possible before the TVM FFI Any support but now we natively support enum class int value conversion with Any, so we can simplify the codepath
Main changes:
tvm::attr::kCallingConvasCallingConvdirectlyCallingConvenum values