Skip to content

Commit 0ab260b

Browse files
committed
Add a TODO for wasm32 issues
1 parent 69077da commit 0ab260b

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

plans/wasm32-todo.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# wasm32 TODO: DSL `int(...)` Cast Path
2+
3+
Last updated: 2026-02-19
4+
5+
## Context
6+
7+
In `python-blosc2` on wasm32/Pyodide, DSL kernels that use index symbols with `int(...)` casting still fail in practice for this shape:
8+
9+
- DSL kernel: `return int(_i0 * _n1 + _i1)`
10+
- Typical integration symptom: `DSL kernels require miniexpr ... miniexpr compilation or execution failed`
11+
- Current status in python-blosc2: expected-to-fail behavior is still kept for wasm32.
12+
13+
This is likely either:
14+
- a true miniexpr wasm32 cast/runtime gap, or
15+
- an integration mismatch between python-blosc2's prefilter setup and miniexpr's supported dtype/cast combinations.
16+
17+
## Goal
18+
19+
Make DSL `int(...)` casting reliable on wasm32 for ND/index-symbol expressions (or explicitly declare and document it as unsupported with precise diagnostics).
20+
21+
## Work Items
22+
23+
1. Reproduce with a minimal miniexpr-only regression
24+
- Add/extend a wasm-executed test that mirrors python-blosc2 usage:
25+
- ND expression with `_i0`, `_i1`, `_n1`
26+
- explicit output dtype `ME_INT64`
27+
- both no-input and with-input variants
28+
- Candidate files:
29+
- `tests/test_nd.c`
30+
- `tests/test_dsl_syntax.c`
31+
32+
2. Confirm whether miniexpr core already passes the scenario
33+
- If miniexpr tests pass but python-blosc2 fails, classify as integration issue and document expected call contract from miniexpr side.
34+
- If miniexpr fails on wasm32, keep investigating below items.
35+
36+
3. Audit cast intrinsic lowering and dtype propagation
37+
- Inspect and validate:
38+
- `dsl_cast_int_intrinsic`
39+
- `dsl_cast_int_target_dtype`
40+
- compile-time dtype selection for DSL statements and return value
41+
- ND output write path for integral dtypes
42+
- Candidate source:
43+
- `src/miniexpr.c`
44+
45+
4. Audit wasm32 runtime behavior for cast-heavy DSL
46+
- Verify interpreter path vs JIT path behavior parity for this kernel.
47+
- Ensure reserved index symbol handling does not accidentally disable needed runtime path.
48+
- Confirm no wasm-only narrowing/overflow bugs in writeback for `ME_INT64`.
49+
50+
5. Strengthen diagnostics for unsupported cast combos
51+
- If a cast combination is intentionally unsupported on wasm32, return an explicit error reason (not generic execution failure).
52+
- Add tests that assert the exact reason.
53+
54+
6. Add parity tests and CI coverage
55+
- Native + wasm32 parity for:
56+
- `int(3.9)`
57+
- `int(_i0 * _n1 + _i1)`
58+
- `float(int(x)) + bool(x)`
59+
- mixed input dtype to integer output
60+
- Ensure these tests run in the wasm32 CI lane.
61+
62+
## Validation Commands (suggested)
63+
64+
```bash
65+
# native
66+
cmake -S . -B build -DMINIEXPR_BUILD_TESTS=ON
67+
cmake --build build -j
68+
ctest --test-dir build --output-on-failure -R "test_nd|test_dsl_syntax|test_dsl_jit_runtime_cache"
69+
70+
# wasm32
71+
emcmake cmake -S . -B build-wasm32 -DMINIEXPR_BUILD_TESTS=ON
72+
cmake --build build-wasm32 -j
73+
ctest --test-dir build-wasm32 --output-on-failure -R "test_nd|test_dsl_syntax|test_dsl_jit_runtime_cache"
74+
```
75+
76+
## Exit Criteria
77+
78+
- `int(_i0 * _n1 + _i1)` works on wasm32 in miniexpr and in python-blosc2 integration, with deterministic behavior and tests.
79+
- OR behavior is explicitly unsupported, documented, and enforced by a precise, tested error path.

0 commit comments

Comments
 (0)