"src/vscode:/vscode.git/clone" did not exist on "d771f6b51026c19d4225d2e04c4dc3a48ab64514"
Commit 332a266c authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

add multi_stride for kernel shapes.

Add stride based multi-index similar to device functions. Between the device
gather and what's available for jit it looks like we're using lens instead of
strides to calculate indicies.

Seems to fix the 1d case of indices for this jit gather.
parent ce2b0c22
...@@ -128,6 +128,20 @@ struct shape ...@@ -128,6 +128,20 @@ struct shape
result[0] = tidx; result[0] = tidx;
return result; return result;
} }
/// Convert single index into a multi-index
constexpr index_array multi_stride(index_int idx) const
{
index_array result;
index_int tidx = idx;
for(diff_int is = result.size() - 1; is > 0; is--)
{
result[is] = tidx % strides[is];
tidx = tidx / strides[is];
}
result[0] = tidx;
return result;
}
/// Convert multi-index into a single index /// Convert multi-index into a single index
constexpr index_int single(index_array idx) const constexpr index_int single(index_array idx) const
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment