Skip to content

Enable support for multiple kernels for xeus-cpp-lite #290

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 3 commits into from
May 6, 2025

Conversation

anutosh491
Copy link
Collaborator

@anutosh491 anutosh491 commented Apr 17, 2025

Description

Fixes #185

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.78%. Comparing base (66510a4) to head (2e28107).

Files with missing lines Patch % Lines
src/xinterpreter.cpp 60.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #290      +/-   ##
==========================================
- Coverage   82.00%   81.78%   -0.22%     
==========================================
  Files          20       20              
  Lines         950      950              
  Branches       87       87              
==========================================
- Hits          779      777       -2     
- Misses        171      173       +2     
Files with missing lines Coverage Δ
src/xinterpreter.cpp 90.10% <60.00%> (-1.10%) ⬇️
Files with missing lines Coverage Δ
src/xinterpreter.cpp 90.10% <60.00%> (-1.10%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@anutosh491
Copy link
Collaborator Author

anutosh491 commented Apr 17, 2025

Screen.Recording.2025-04-17.at.1.47.31.PM.mp4

Demo above : Shows 3 xeus-cpp-lite kernels built (all use different flags -std=c++17/20/23)

On top of which xcpp20 is built using the -msimd128 flag (required for running simd code in the browser)

  "argv": [
      "@XEUS_CPP_KERNELSPEC_PATH@xcpp",
      "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@",
      "-std=c++20", "-msimd128"
  ],
  
// instead of 

  "argv": [
      "@XEUS_CPP_KERNELSPEC_PATH@xcpp",
      "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@",
      "-std=c++23", 
  ],

So xcpp20 kernel would work but xcpp23 wouldn't !

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@anutosh491 anutosh491 force-pushed the add_kernels branch 2 times, most recently from dbf3ed8 to b782277 Compare April 30, 2025 09:03
@anutosh491
Copy link
Collaborator Author

clang-format is a bit too much (probably can be ignored here ?)

@anutosh491 anutosh491 marked this pull request as ready for review April 30, 2025 10:14
@mcbarton mcbarton requested a review from vgvassilev April 30, 2025 20:21
@anutosh491
Copy link
Collaborator Author

Hey @JohanMabille @martinRenou

As y'all helped me with the design here on the JupyterLite, could y'all review the changes here for me ?

  1. After this we should see 3 kernels through our deployment link
  2. We are preloading the path to clang's resource-dir (/lib/clang/20 where 20 is latest llvm version) into the file system. This provides the header wasm_simd128.h for xsimd to run in the browser.
  3. As a ToDo
    After the next cppinterop release, we would also be able to address this Fix exception handling (throw) in xeus-cpp-lite. #222

So currently xeus-cpp-lite doesn't have exception handling due to missing emscripten flags.
But we should soon be able to make this change

{
  "display_name": "C++20",
  "argv": [
      "@XEUS_CPP_KERNELSPEC_PATH@xcpp",
      "-resource-dir", "@XEUS_CPP_RESOURCE_DIR@",
-      "-std=c++20"
+      "-std=c++20", "-mllvm", "-enable-emscripten-cxx-exceptions"
  ],
  

And support this as I tried building on main

image

Copy link

@martinRenou martinRenou left a comment

Choose a reason for hiding this comment

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

Really cool to finally get multiple kernel specs support in JupyterLite!

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@anutosh491 anutosh491 requested a review from JohanMabille May 6, 2025 08:50
@anutosh491 anutosh491 merged commit ebf17f8 into compiler-research:main May 6, 2025
15 of 16 checks passed
@anutosh491 anutosh491 deleted the add_kernels branch May 6, 2025 12:47
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.

Fix kernel configuration for xeus-cpp-lite
5 participants