Skip to content

[Tests] avoid including sycl.hpp in tests - #1977

Open
tdavidcl wants to merge 4 commits into
Shamrock-code:mainfrom
tdavidcl:speedup_compil
Open

[Tests] avoid including sycl.hpp in tests#1977
tdavidcl wants to merge 4 commits into
Shamrock-code:mainfrom
tdavidcl:speedup_compil

Conversation

@tdavidcl

@tdavidcl tdavidcl commented Aug 4, 2026

Copy link
Copy Markdown
Member

Shave off around 30 sec of build wall time on my Mac
393s of sycl.hpp header cost -> 361s

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ba27c8eb-f049-4ee0-a331-e03e8837b43d

📥 Commits

Reviewing files that changed from the base of the PR and between f457c21 and 47b18c5.

📒 Files selected for processing (1)
  • src/tests/shambase/WithUUID_tests.cpp

📝 Walkthrough

Walkthrough

The change adds missing standard and SYCL includes across framework and test sources. It also changes assert_float_equal to use std::fabs for f64 absolute-difference calculations.

Changes

Header and assertion updates

Layer / File(s) Summary
Explicit headers and floating-point assertion handling
src/shamtest/details/TestAssertList.hpp, src/shamtest/shamtest.hpp, src/tests/shambase/ConstantsTests.cpp, src/tests/shamformat/format_tests.cpp, src/tests/shammodels/gsph/GSPHIntegrationTests.cpp, src/tests/shamsys/LogTests.cpp, src/tests/shambase/WithUUID_tests.cpp
TestAssertList includes floating-point aliases and uses std::fabs. The framework includes <optional>. Tests include the standard output, mutex, and SYCL headers they use.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that tests avoid including sycl.hpp, which matches the main change.
Description check ✅ Passed The description explains that the change removes sycl.hpp build overhead in tests and reduces Mac build time.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tdavidcl
tdavidcl enabled auto-merge (squash) August 4, 2026 20:42
@tdavidcl
tdavidcl disabled auto-merge August 4, 2026 21:24
@github-actions

github-actions Bot commented Aug 4, 2026

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/shamtest/details/TestAssertList.hpp`:
- Line 120: Update TestAssertList.hpp around assert_float_equal to include
<cmath> directly before using std::fabs, since shambase/aliases_float.hpp only
provides aliases and should not be relied on for that declaration. Keep the
existing std::fabs-based comparison unchanged, and make the header
self-sufficient so it does not depend on a transitive include.

In `@src/tests/shammodels/gsph/GSPHIntegrationTests.cpp`:
- Line 23: Remove the unused shambackends/sycl.hpp include from
GSPHIntegrationTests.cpp, leaving the test’s standard library includes and
implementation unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e8a75768-dc08-40a2-b5e1-b461acb58c8c

📥 Commits

Reviewing files that changed from the base of the PR and between 149b4c8 and f457c21.

📒 Files selected for processing (6)
  • src/shamtest/details/TestAssertList.hpp
  • src/shamtest/shamtest.hpp
  • src/tests/shambase/ConstantsTests.cpp
  • src/tests/shamformat/format_tests.cpp
  • src/tests/shammodels/gsph/GSPHIntegrationTests.cpp
  • src/tests/shamsys/LogTests.cpp

inline void assert_float_equal(
std::string assert_name, f64 a, f64 b, f64 eps, SourceLocation loc = SourceLocation{}) {
f64 diff = sycl::fabs(a - b);
f64 diff = std::fabs(a - b);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '`#include`.*cmath|std::fabs|fabs' \
  src/shamtest/details/TestAssertList.hpp \
  src/shambase/aliases_float.hpp

Repository: Shamrock-code/Shamrock

Length of output: 320


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'Candidate include/search files:\n'
git ls-files | rg '(^|/)(TestAssertList\.hpp|aliases_float\.hpp|.*float.*\.hpp|.*assert.*\.hpp)$' || true

printf '\nIncludes in TestAssertList.hpp:\n'
sed -n '1,160p' src/shamtest/details/TestAssertList.hpp

printf '\nSearch for aliases_float.hpp and cmath include chain:\n'
rg -n 'aliases_float|<cmath>|<cmath>|fabs|std::fabs|stl' --glob '*.{hpp,h,hxx,cpp,cc}' .

Repository: Shamrock-code/Shamrock

Length of output: 26476


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'aliases_float.hpp:\n'
cat -n src/shambase/include/shambase/aliases_float.hpp

printf '\nfloats.hpp:\n'
cat -n src/shambase/include/shambase/floats.hpp

printf '\nDirect includes of cmath by shambase aliases_float transitive chain candidates:\n'
rg -n -U '(^|[^:])(`#include`\s*<[^>]*cmath>|^//\s*.*cmath|std::fabs|fabs)' src/shambase/include/shambase/aliases_float.hpp

Repository: Shamrock-code/Shamrock

Length of output: 2699


Include <cmath> for std::fabs.

TestAssertList.hpp uses std::fabs, but shambase/aliases_float.hpp only defines numeric aliases and does not include <cmath>. Add <cmath> directly so assert_float_equal does not depend on a transitive include.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/shamtest/details/TestAssertList.hpp` at line 120, Update
TestAssertList.hpp around assert_float_equal to include <cmath> directly before
using std::fabs, since shambase/aliases_float.hpp only provides aliases and
should not be relied on for that declaration. Keep the existing std::fabs-based
comparison unchanged, and make the header self-sufficient so it does not depend
on a transitive include.

* - Edge cases (zero acceleration, constant force)
*/

#include "shambackends/sycl.hpp"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n '`#include`.*sycl|sycl::|sycl/' \
  src/shambackends/sycl.hpp \
  src/tests/shammodels/gsph/GSPHIntegrationTests.cpp

Repository: Shamrock-code/Shamrock

Length of output: 317


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files matching sycl.hpp:"
git ls-files | grep -E '(^|/)sycl\.hpp$|GSPHIntegrationTests\.cpp$' || true

echo
echo "Tracked files containing shambackends/sycl.hpp:"
rg -n 'include\s+"?shambackends/sycl.hpp"?|sycl::|sycl/' . || true

Repository: Shamrock-code/Shamrock

Length of output: 50379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Candidate wrapper files:"
git ls-files | grep -E '(^|/)shambackends/sycl\.hpp$' || true

echo
echo "Exact tracked include definitions:"
rg -n 'define SHAMROCK.*SYCL|include <sycl|include "sycl|namespace shambackends|sycl::' $(git ls-files | grep -E '\.(h|hpp|cc|cpp)$' | grep -v node_modules) | head -200 || true

echo
echo "GSPH test include block:"
sed -n '1,60p' src/tests/shammodels/gsph/GSPHIntegrationTests.cpp

echo
echo "GSHP test direct sycl usages only:"
rg -n 'sycl::|shambackends/sycl|"sycl' src/tests/shammodels/gsph/GSPHIntegrationTests.cpp || true

Repository: Shamrock-code/Shamrock

Length of output: 24606


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "shambackends/sycl.hpp:"
cat -n src/shambackends/include/shambackends/sycl.hpp

echo
echo "shambackends include directory contents:"
git ls-files src/shambackends/include/shambackends | sort

echo
echo "GSHP test tail:"
wc -l src/tests/shammodels/gsph/GSPHIntegrationTests.cpp
tail -n 120 src/tests/shammodels/gsph/GSPHIntegrationTests.cpp

echo
echo "Any direct sycl include or use from GSPHIntegrationTests.cpp:"
python3 - <<'PY'
from pathlib import Path
p = Path("src/tests/shammodels/gsph/GSPHIntegrationTests.cpp")
text = p.read_text()
for i,line in enumerate(text.splitlines(),1):
    if "sycl" in line:
        print(f"{i}: {line}")
PY

Repository: Shamrock-code/Shamrock

Length of output: 8049


Remove the unused SYCL backend include.

GSPHIntegrationTests.cpp only uses standard library types and includes shambackends/sycl.hpp, which exports <sycl/sycl.hpp>. The test has no sycl usage, so drop this include.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tests/shammodels/gsph/GSPHIntegrationTests.cpp` at line 23, Remove the
unused shambackends/sycl.hpp include from GSPHIntegrationTests.cpp, leaving the
test’s standard library includes and implementation unchanged.

@tdavidcl

tdavidcl commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown

Merge Queue Status

  • 🟠 Waiting for queue conditions
  • ⏳ Enter queue
  • ⏳ Run checks
  • ⏳ Merge
Waiting for any of
  • check-neutral = all
  • check-skipped = all
  • check-success = all
All conditions
  • any of [🔀 queue conditions]:
    • all of [📌 queue conditions of queue rule main queue]:
      • any of [🛡 GitHub branch protection]:
        • check-neutral = all
        • check-skipped = all
        • check-success = all
      • github-review-approved [🛡 GitHub branch protection]
      • any of [🛡 GitHub branch protection]:
        • check-success = pre-commit.ci - pr
        • check-neutral = pre-commit.ci - pr
        • check-skipped = pre-commit.ci - pr
  • -closed [📌 queue requirement]
  • -conflict [📌 queue requirement]
  • -draft [📌 queue requirement]
  • any of [📌 queue -> configuration change requirements]:
    • -mergify-configuration-changed
    • check-success = Configuration changed
  • any of [📌 queue requirement]:
    • check-neutral = Mergify Merge Protections
    • check-skipped = Mergify Merge Protections
    • check-success = Mergify Merge Protections

@tdavidcl

tdavidcl commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown

queue

☑️ Command queue ignored because it is already running from a previous command.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Workflow report

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

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 : 4
New warnings : 4
Warnings count : 8098 → 8098 (0.0%)

Detailed changes :
- src/shamtest/shamtest.hpp:122: warning: Member ANY_WORLD_SIZE (macro definition) of file shamtest.hpp is not documented.
+ src/shamtest/shamtest.hpp:123: warning: Member ANY_WORLD_SIZE (macro definition) of file shamtest.hpp is not documented.
- src/shamtest/shamtest.hpp:124: warning: Member _internal_new_test(type, name, func_name, func_ptr, class_name, node_cnt) (macro definition) of file shamtest.hpp is not documented.
+ src/shamtest/shamtest.hpp:125: warning: Member _internal_new_test(type, name, func_name, func_ptr, class_name, node_cnt) (macro definition) of file shamtest.hpp is not documented.
- src/shamtest/shamtest.hpp:162: warning: Member STDSTRINGIFY(x) (macro definition) of file shamtest.hpp is not documented.
+ src/shamtest/shamtest.hpp:163: warning: Member STDSTRINGIFY(x) (macro definition) of file shamtest.hpp is not documented.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tdavidcl

tdavidcl commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@Mergifyio queue

@mergify

mergify Bot commented Aug 5, 2026

Copy link
Copy Markdown

queue

☑️ Command queue ignored because it is already running from a previous command.

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.

2 participants