Skip to content

Conversation

@ajakubowicz-canva
Copy link
Contributor

@ajakubowicz-canva ajakubowicz-canva commented Jun 24, 2025

Context

This is a test only PR - adding additional test coverage for scalar vello_cpu tests running on the browser.

Before this PR:

$ wasm-pack test --firefox --headless --features=webgl
test result: ok. 85 passed; 0 failed; 165 ignored; 0 filtered out; finished in 7.49s

After this PR:

$ wasm-pack test --firefox --headless --features=webgl
test result: ok. 581 passed; 0 failed; 169 ignored; 0 filtered out; finished in 22.18s

This can also be seen in CI of this PR.

Changes

  • load_image has been moved into utils and has become a macro. This is required such that WASM can embed the image assets into the compiled WASM binary (as wasm doesn't have access to filesystem).
  • Most changes are to the vello_test proc macro, which now generates two additional tests, a u8 and f32 scalar wasm cpu test.

Test plan

This whole PR is the test.

@ajakubowicz-canva ajakubowicz-canva added the C-cpu Applies to the vello_cpu crate label Jun 24, 2025
@ajakubowicz-canva ajakubowicz-canva added the testing Improvements to automated testing label Jun 24, 2025

fn rgb_img_10x10() -> Arc<Pixmap> {
load_image("rgb_image_10x10")
load_image!("rgb_image_10x10")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just FYI there will probably be conflicts with the image rendering PR for vello_hybrid, but I guess not much we can do for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great callout! @grebmeg would you like me to hold this PR back until images has landed, or are you ok with the rebase and replacing load_image with load_image!? (I think it should be a syntactic only change).

Copy link
Collaborator

Choose a reason for hiding this comment

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

@AndrewJakubowicz No need to wait on me — feel free to go ahead and get this landed.

@ajakubowicz-canva
Copy link
Contributor Author

ajakubowicz-canva commented Jun 24, 2025

Ooops, this PR has revealed that there is a bug in fearless_simd in the WASM architecture. fearless_simd on WASM should only add SIMD instructions if the target is compiled with the +simd128 target feature. It looks like I stuffed something up because the test binary contains lots of simd instructions even though the fallback level is expected, and the WASM is not being built with +simd128.

@ajakubowicz-canva
Copy link
Contributor Author

After further investigation, this PR is safe to land. The SIMD in the WASM binary would not be encountered during the tests, and is instead instructions included due to target_feature declarations. That is resolved in: https://github.com/raphlinus/fearless_simd/pull/16

@ajakubowicz-canva ajakubowicz-canva added this pull request to the merge queue Jun 25, 2025
Merged via the queue into main with commit 8a2b6b4 Jun 25, 2025
17 checks passed
@ajakubowicz-canva ajakubowicz-canva deleted the ajakubowicz-vello_cpu-wasm-tests branch June 25, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cpu Applies to the vello_cpu crate testing Improvements to automated testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants