Skip to content

Conversation

AdUhTkJm
Copy link
Contributor

There are some subtleties here.

This is the code in OG:

// note: this is different from default ABI
if (!RetTy->isScalarType())
  return ABIArgInfo::getDirect();

which says we should return structs directly. It's correct, has have the same behaviour as nvcc, and it obeys the PTX ABI as well.
The comment dates back to 2013 (see this commit -- it didn't provide any explanation either), so I believe it's outdated. I didn't include this comment in the PR.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good pending some nits

// getKind() > BuiltinType::Void && getKind() <= BuiltinType::NullPtr
// which is confusing and unavailable in CIR.
// Here we manually list out all corresponding types in CIR.
return isa<IntType, BoolType, SingleType, DoubleType, FP16Type, FP128Type,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a helper function in clang/include/clang/CIR/Dialect/IR/CIRTypes.h, just like we have isAnyFloatingPointType, we should also have isScalarType, and just use it here.

@bcardosolopes
Copy link
Member

Seems like there are failing tests too

@AdUhTkJm AdUhTkJm force-pushed the main branch 2 times, most recently from 41f78d0 to 01b8beb Compare March 11, 2025 22:30
@bcardosolopes bcardosolopes changed the title [CIR][CUDA} CallConvLowering for basic types in NVPTX [CIR][CUDA] CallConvLowering for basic types in NVPTX Mar 12, 2025
Copy link

github-actions bot commented Mar 12, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@AdUhTkJm AdUhTkJm force-pushed the main branch 2 times, most recently from 70af95d to 04a435e Compare March 12, 2025 11:35
@bcardosolopes bcardosolopes merged commit a846f29 into llvm:main Mar 17, 2025
6 checks passed
lanza pushed a commit that referenced this pull request Mar 18, 2025
There are some subtleties here.

This is the code in OG:
```cpp
// note: this is different from default ABI
if (!RetTy->isScalarType())
  return ABIArgInfo::getDirect();
```
which says we should return structs directly. It's correct, has have the
same behaviour as `nvcc`, and it obeys the PTX ABI as well.
The comment dates back to 2013 (see [this
commit](llvm/llvm-project@f9329ff)
-- it didn't provide any explanation either), so I believe it's
outdated. I didn't include this comment in the PR.
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
There are some subtleties here.

This is the code in OG:
```cpp
// note: this is different from default ABI
if (!RetTy->isScalarType())
  return ABIArgInfo::getDirect();
```
which says we should return structs directly. It's correct, has have the
same behaviour as `nvcc`, and it obeys the PTX ABI as well.
The comment dates back to 2013 (see [this
commit](llvm/llvm-project@f9329ff)
-- it didn't provide any explanation either), so I believe it's
outdated. I didn't include this comment in the PR.
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.

2 participants