-
Notifications
You must be signed in to change notification settings - Fork 75
Fix deprecated LLVM PointerType::getUnqual(Type*) for opaque pointer compatibility #5820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix deprecated LLVM PointerType::getUnqual(Type*) for opaque pointer compatibility #5820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates LLVM pointer type creation from the deprecated typed pointer API (PointerType::getUnqual(Type*)) to the opaque pointer API (PointerType::getUnqual(LLVMContext&)) to ensure compatibility with LLVM 18.1+, which has deprecated typed pointers in favor of opaque pointers.
Changes:
- Updated four helper functions in
jit.cppto use context-only overload - Updated two
CreateBitCastoperations injit_tensor_utils.cppto use context-only overload - Added explanatory comments for all changes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| csrc/host_ir/jit.cpp | Updated getInt8PtrType(), getInt8PtrDynamicArrayType(), getTensorPtrType(), and getInt64PtrType() to use opaque pointer API |
| csrc/host_ir/jit_tensor_utils.cpp | Updated two CreateBitCast operations in packTensorArgument() to use opaque pointer API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR completes the LLVM opaque pointer migration by replacing the deprecated Changes:
Context: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Client Code
participant Helpers as Helper Functions
participant LLVM_Old as LLVM Typed Pointer API
participant LLVM_New as LLVM Opaque Pointer API
Note over Client,LLVM_New: Before PR #5820
Client->>Helpers: getInt8PtrType(context)
Helpers->>LLVM_Old: PointerType::getUnqual(Int8Ty)
LLVM_Old-->>Helpers: Typed pointer (deprecated)
Helpers-->>Client: i8* type
Note over Client,LLVM_New: After PR #5820
Client->>Helpers: getInt8PtrType(context)
Helpers->>LLVM_New: PointerType::getUnqual(context)
LLVM_New-->>Helpers: Opaque pointer
Helpers-->>Client: ptr type
Note over Client,LLVM_New: BitCast Operations
Client->>Helpers: packTensorArgument(...)
Helpers->>LLVM_Old: CreateBitCast(ptr, getUnqual(Int8Ty))
LLVM_Old-->>Helpers: Typed cast (deprecated)
Helpers->>LLVM_New: CreateBitCast(ptr, getUnqual(context))
LLVM_New-->>Helpers: Opaque cast
Helpers-->>Client: Packed tensor
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 comment
…compatibility Replace PointerType::getUnqual(Type*) with PointerType::getUnqual(LLVMContext&) to fix build errors with newer LLVM versions that have deprecated the typed pointer APIs in favor of opaque pointers. The typed pointer overload `PointerType::getUnqual(Type*)` is deprecated and pending removal. The context-only overload has been available since LLVM 18.1 and maintains identical semantics (address space 0) for opaque pointers. Changes: - jit.cpp: Update getInt8PtrType(), getInt8PtrDynamicArrayType(), getTensorPtrType(), and getInt64PtrType() helper functions - jit_tensor_utils.cpp: Update packTensorArgument() BitCast operations Fixes regression from PR NVIDIA#5576 which only partially addressed the issue by changing Type::getPointerTo() to PointerType::getUnqual(Type*), but that API is also deprecated.
98be20b to
95c9b97
Compare
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
Summary
Replace
PointerType::getUnqual(Type*)withPointerType::getUnqual(LLVMContext&)to fix build errors with newer LLVM versions that have deprecated the typed pointer APIs in favor of opaque pointers.The typed pointer overload is deprecated and pending removal. The context-only overload has been available since LLVM 18.1 and maintains identical semantics (address space 0) for opaque pointers.
Changes
jit.cpp: UpdategetInt8PtrType(),getInt8PtrDynamicArrayType(),getTensorPtrType(), andgetInt64PtrType()helper functionsjit_tensor_utils.cpp: UpdatepackTensorArgument()BitCast operationsTest plan
import nvfuserworks correctlyTested with: LLVM 21.1.5 (deprecation warnings become errors in LLVM 20+ with
-Werror)Fixes regression from #5576 which only partially addressed the issue.
Related to #5575