Skip to content

Resolve test failures #17436

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

Merged
merged 1 commit into from
Mar 14, 2025
Merged

Resolve test failures #17436

merged 1 commit into from
Mar 14, 2025

Conversation

premanandrao
Copy link
Contributor

No description provided.

@premanandrao premanandrao requested a review from a team as a code owner March 13, 2025 02:58
@premanandrao
Copy link
Contributor Author

This is to resolve test failures after llvm/llvm-project@39ec9de

@premanandrao premanandrao requested a review from Fznamznon March 13, 2025 03:00
@premanandrao
Copy link
Contributor Author

@Fznamznon, could you please review this? I am not a 100% sure.

Src = Builder.CreateAddrSpaceCast(
Src,
llvm::PointerType::get(VMContext, DstTy->getPointerAddressSpace()));
SrcTy = Src->getType();
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please clarify why this change is needed and why it was not needed before?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The AddressSpaceCast was added by us (@elizabethandrews in '22) but not upstreamed and the assert was added by community in '23. The reason we didn't need to make the change before I guess because we didn't trip the assertion.

The assertion feels right to me; the pointer types should have the same address space at that point. The thing is, we adjusted the Src expression above, but the SrcTy still refers to the unadjusted Src expression. Since the expression is reset, the type also should be, otherwise we are asserting something that has since changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I was curious why didn't we hit the assertion before...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The community change changes sret address space to that of the alloca address space, instead of the address space of the pointee. For the test case in CodeGenCXX/sret_cast_with_nonzero_alloca_as.cpp, this results in an AS of 0 instead of 4. (We cast it away in this case, but we didn't need to before.)

Copy link
Contributor

@Naghasan Naghasan Mar 13, 2025

Choose a reason for hiding this comment

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

The thing is, we adjusted the Src expression above, but the SrcTy still refers to the unadjusted Src expression.

Poping years after the patch, but this adjustment (for __builtin_alloca) doesn't look right here. It should probably be handled in the AST by adding the CK_AddressSpaceConversion or when we codegen the builtin by returning the cast address space. I think the 2nd option is more right as it is applying the SYCL address space deduction rules (the first makes assumption on the target address spaces in the AST).

Copy link
Contributor

Choose a reason for hiding this comment

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

We may leave this "as-is" to resolve failures in pulldown and capture this

It should probably be handled in the AST by adding the CK_AddressSpaceConversion or when we codegen the builtin by returning the cast address space. I think the 2nd option is more right as it is applying the SYCL address space deduction rules (the first makes assumption on the target address spaces in the AST).

in a separate tracker.

The overall change of sret address space doesn't seem like a concern. It is this snippet of code is... strange.

Copy link
Contributor

Choose a reason for hiding this comment

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

We may leave this "as-is" to resolve failures

Oh absolutely, my comment is clearly out of scope of the PR ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Were you referring to the community FIXME below as "strange" or something else?

I can file a tracker for a proper fix later on, so we can make progress here. If you and @Naghasan can add specifics to it, I would appreciate it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Were you referring to the community FIXME below as "strange" or something else?

I was referring to the downstream code.

Copy link
Contributor

@Naghasan Naghasan Mar 13, 2025

Choose a reason for hiding this comment

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

No, the CreateAddrSpaceCast above (added in '22). I agree with the comment below, an address space cast shouldn't happen here and I think the one above is avoidable.

@jsji jsji merged commit 48dfaa4 into intel:sycl-web Mar 14, 2025
AlexeySachkov pushed a commit to AlexeySachkov/llvm that referenced this pull request May 28, 2025
This is a cherry-pick of intel#17436 with slight modifications to
`regcall-cc-test.cpp` to make it pass

Patch-By: premanandrao <premanand.m.rao@intel.com>
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.

4 participants