Skip to content

[SYCL] Avoid redundant deep device type checks - #23062

Merged
uditagarwal97 merged 7 commits into
intel:syclfrom
vmustya:sycl-sema-typecheck-optimize-alloc
Sep 4, 2026
Merged

[SYCL] Avoid redundant deep device type checks#23062
uditagarwal97 merged 7 commits into
intel:syclfrom
vmustya:sycl-sema-typecheck-optimize-alloc

Conversation

@vmustya

@vmustya vmustya commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Skip types that cannot contain zero-length arrays, use an inline visited
set, and cache successfully validated complete record definitions. This
reduces temporary allocations from repeated SYCL type validation while
preserving diagnostics for invalid and incomplete records.

Assisted-by: GPT-5.6 Terra noreply@openai.com

Skip types that cannot contain zero-length arrays, use an inline visited
set, and cache successfully validated complete record definitions. This
reduces temporary allocations from repeated SYCL type validation while
preserving diagnostics for invalid and incomplete records.

Assisted-by: GPT-5.6 Terra <noreply@openai.com>
@vmustya
vmustya marked this pull request as ready for review August 31, 2026 20:39
@vmustya
vmustya requested a review from a team as a code owner August 31, 2026 20:39
@vmustya

vmustya commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

This change reduces the number of memory allocation calls in the frontend by ~8%, when compiling a simple SYCL free function kernel test case for device.

Comment thread clang/lib/Sema/SemaSYCL.cpp Outdated

@koparasy koparasy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@tahonermann tahonermann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of comments. I think the CanonicalDeclPtr change is worth making. There is another bit of code that I'm confused by.

Comment thread clang/lib/Sema/SemaSYCL.cpp
Comment thread clang/include/clang/Sema/SemaSYCL.h Outdated
@vmustya
vmustya requested a review from tahonermann September 2, 2026 17:21
Comment thread clang/lib/Sema/SemaSYCL.cpp Outdated
@vmustya
vmustya requested a review from tahonermann September 2, 2026 21:41

@tahonermann tahonermann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this looks fine. I added one suggestion that might help to avoid spending time on dependent types; I think deepTypeCheckForDevice() shouldn't be called on dependent types in the first place so the new added check for a dependent type is surprising to me.

Comment thread clang/lib/Sema/SemaSYCL.cpp
@YuriPlyakhin

Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers ,
Failure on Windows doesn't look related (still, I restarted the job just in case):

Run Invoke-WebRequest -Uri "https://raw.githubusercontent.com/intel/llvm/refs/heads/sycl/devops/scripts/windows_detect_hung_tests.ps1" -OutFile "windows_detect_hung_tests.ps1" -Headers @{Authorization = "***"}
Test d:\github\_work\llvm\llvm\build-e2e\asynchandler\output\custom_async_handler.cpp.tmp.out hung!
Error: Process completed with exit code 1.

PR is all approved and green. Please, merge.

@uditagarwal97
uditagarwal97 merged commit c2098bb into intel:sycl Sep 4, 2026
35 of 36 checks 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.

5 participants