CSL backend: integer constant in a vector op is emitted as a float, and cslc rejects it
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Start by reproducing the issue with the provided kernel and command, then inspect the compiler path that emits the shown @add16 call and trace how the integer literal becomes 1.0. Done means generated CSL passes the integer constant with the expected type and cslc accepts the output. The payload names no source files or tests, so locate the relevant emission code and add or run a regression check there.
Written by the indexing model from the issue text.
Description
Repro (upstream main @ 984975f, cbcore SDK 202505230211):
kernel @int_const_add<N>(stream<i16, N>[1, 1] readonly a_in, stream<i16, N>[1, 1] writeonly out) {
place i16 i, i16 j in [0, 0] {
i16[N] a
}
compute i16 i, i16 j in [0, 0] {
await receive(a, a_in[i, j])
await map i16 k in [0:N] {
a[k] = a[k] + 1
}
await send(a, out[i, j])
}
}
Commands:
sptlc int_const_add.sptl out_csl --param N=4
Expected:
The generated code_0_0.csl contains @add16(a_in_dsd, a_in_dsd, 1.0); and cslc fails:
code_0_0.csl:22:5: error: operand types do not match expectations
@add16(a_in_dsd, a_in_dsd, 1.0);
code_0_0.csl:22:5: note: got type(s): mem1d_dsd, mem1d_dsd, comptime_float
code_0_0.csl:22:5: note: expected type(s): DSD/DSR, DSD/DSR, i16
LOG: Generated CSL
param memcpy_params;
const sys_mod = @import_module("<memcpy/memcpy>", memcpy_params);
// Benchmarking counters
const timestamp = @import_module("<time>");
// Place block
var a_in: [4]i16;
var out: [4]i16;
var __benchmark_start: [3]u16;
var __benchmark_stop: [3]u16;
var __a_in_ptr: [*]i16 = &a_in;
var __out_ptr: [*]i16 = &out;
var ____benchmark_start_ptr: [*]u16 = &__benchmark_start;
var ____benchmark_stop_ptr: [*]u16 = &__benchmark_stop;
// DSDs
const a_in_dsd = @get_dsd(mem1d_dsd, .{ .tensor_access = |__index|{4} -> a_in[__index] });
const out_dsd = @get_dsd(mem1d_dsd, .{ .tensor_access = |__index|{4} -> out[__index] });
const task_0_id = @get_local_task_id(8);
task task_slot_0() void {
@add16(a_in_dsd, a_in_dsd, 1.0);
@mov16(out_dsd, a_in_dsd);
timestamp.get_timestamp(&__benchmark_stop);
timestamp.disable_tsc();
sys_mod.unblock_cmd_stream();
}
fn int_const_add() void {
timestamp.enable_tsc();
timestamp.get_timestamp(&__benchmark_start);
@activate(task_0_id);
}
comptime {
@export_symbol(__a_in_ptr, "a_in");
@export_symbol(__out_ptr, "out");
@export_symbol(____benchmark_start_ptr, "__benchmark_start");
@export_symbol(____benchmark_stop_ptr, "__benchmark_stop");
@bind_local_task(task_slot_0, task_0_id);
@export_symbol(int_const_add, "int_const_add");
}
- Dominant language
- Python
- Stars
- 12
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from spcl/spada
-
Difficulty 4/5 1-2 days Newbie friendliness 66/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Parameterize stencil SpaDA filesMay be free again @luxfg claimed this 68 days ago, and no pull request is open. Open
-
SpaDA emits raw `[1]f32` refs where CSL requires DSD/DSR operands for async fabric operationsMay be free again @tbennun claimed this 68 days ago, and no pull request is open. Open
-
Nested multiply-accumulate loops lower to scalar code; targeted `@fmacs` vectorization gives 4.5–7.7× on `samples/spatial/blas/gemv.sptl`Possibly taken @ycmath claimed this 89 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
software-mansion-labs/Diplomat#20 ·
Maintainers usually reply within 1 day
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
View Counts discarded due to field name mismatchPossibly taken @rsiva0400 claimed this today. Opensite-bug triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Model version publishes the new UK firm entity as a personPossibly taken @vahid-ahmadi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PolicyEngine/policyengine.py#764 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
spcl/HPCAgent-Bench#264 ·
Maintainers usually reply within 1 day