Skip to content

[Backends] use c++20 to improve error messages#1814

Draft
tdavidcl wants to merge 1 commit into
Shamrock-code:mainfrom
tdavidcl:better_kernel_call_error_messages
Draft

[Backends] use c++20 to improve error messages#1814
tdavidcl wants to merge 1 commit into
Shamrock-code:mainfrom
tdavidcl:better_kernel_call_error_messages

Conversation

@tdavidcl
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks @tdavidcl for opening this PR!

You can do multiple things directly here:
1 - Comment pre-commit.ci run to run pre-commit checks.
2 - Comment pre-commit.ci autofix to apply fixes.
3 - Add label autofix.ci to fix authorship & pre-commit for every commit made.
4 - Add label light-ci to only trigger a reduced & faster version of the CI (need the full one before merge).
5 - Add label trigger-ci to create an empty commit to trigger the CI.

Once the workflow completes a message will appear displaying informations related to the run.

Also the PR gets automatically reviewed by gemini, you can:
1 - Comment /gemini review to trigger a review
2 - Comment /gemini summary for a summary
3 - Tag it using @gemini-code-assist either in the PR or in review comments on files

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a kernel_invocable concept and supporting template infrastructure to enforce type-safe signatures for kernel calls. Feedback indicates that the added test case in kernel_call_tests.cpp contains redundant logic and a type mismatch—specifically, passing a constant buffer to a non-const lambda parameter—which will cause a compilation failure under the new constraints.

Comment on lines +68 to +79
sham::kernel_call(
dev_sched->get_queue(),
sham::MultiRef{rho_field_const, uint_field_const},
sham::MultiRef{P_field, cs_field},
size,
[](u32 i, const T *__restrict rho, T *__restrict U, T *__restrict P, T *__restrict cs) {
T r = rho[i];
T u = U[i];

P[i] = r;
cs[i] = u;
});
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.

high

This sham::kernel_call block is redundant as it performs the same operation as the previous call (lines 52-67). Please refactor this duplicated logic into a helper function or lambda to improve readability and maintainability. Additionally, it contains a type mismatch: uint_field_const is a const buffer providing a const T*, but the lambda signature expects a non-const T*. This mismatch will cause a compilation error with the kernel_invocable concept, preventing the test suite from compiling.

References
  1. Refactor duplicated logic into a helper function or lambda to improve readability and maintainability.

@github-actions
Copy link
Copy Markdown
Contributor

Workflow report

workflow report corresponding to commit a71d343
Commiter email is timothee.davidcleris@proton.me

Light CI is enabled. This will only run the basic tests and not the full tests.
Merging a PR require the job "on PR / all" to pass which is disabled in this case.

Pre-commit check report

Pre-commit check: ✅

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for merge conflicts................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for broken symlinks................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
No-tabs checker..........................................................Passed
Tabs remover.............................................................Passed
cmake-format.............................................................Passed
Validate GitHub Workflows................................................Passed
clang-format.............................................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed
Check doxygen headers....................................................Passed
Check license headers....................................................Passed
Check #pragma once.......................................................Passed
Check SYCL #include......................................................Passed
No ssh in git submodules remote..........................................Passed
No UTF-8 in files (except for authors)...................................Passed

Test pipeline can run.

Doxygen diff with main

Removed warnings : 3
New warnings : 8
Warnings count : 8706 → 8711 (0.1%)

Detailed changes :
+ src/shambackends/include/shambackends/kernel_call.hpp:329: warning: Compound sham::details::tuple_to_signature< std::tuple< Ts... > > is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:330: warning: Member type (typedef) of struct sham::details::tuple_to_signature< std::tuple< Ts... > > is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:334: warning: Compound sham::details::kernel_gen_args is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:336: warning: Member args_types (typedef) of struct sham::details::kernel_gen_args is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:347: warning: Member kernel_expected_signature (typedef) of namespace sham::details is not documented.
- src/shambackends/include/shambackends/kernel_call.hpp:353: warning: The following parameter of sham::kernel_call(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&func, SourceLocation &&callsite=SourceLocation{}) is not documented:
+ src/shambackends/include/shambackends/kernel_call.hpp:395: warning: The following parameter of sham::kernel_call(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&func, SourceLocation &&callsite=SourceLocation{}) is not documented:
- src/shambackends/include/shambackends/kernel_call.hpp:546: warning: Member kernel_call_hndl(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&kernel_gen, SourceLocation &&callsite=SourceLocation{}) (function) of namespace sham is not documented.
- src/shambackends/include/shambackends/kernel_call.hpp:546: warning: Member kernel_call_hndl(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&kernel_gen, SourceLocation &&callsite=SourceLocation{}) (function) of namespace sham is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:588: warning: Member kernel_call_hndl(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&kernel_gen, SourceLocation &&callsite=SourceLocation{}) (function) of namespace sham is not documented.
+ src/shambackends/include/shambackends/kernel_call.hpp:588: warning: Member kernel_call_hndl(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&kernel_gen, SourceLocation &&callsite=SourceLocation{}) (function) of namespace sham is not documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant