Skip to content

Commit

Permalink
v1.2.5
Browse files Browse the repository at this point in the history
+ Add missing test file
  • Loading branch information
saipraveenb25 committed Sep 3, 2024
1 parent 57f5e78 commit 695bc9f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "slangtorch"
version = "1.2.4"
version = "1.2.5"
dependencies = [
"torch>=1.1.0",
"hatchling>=1.11.0",
Expand Down
24 changes: 24 additions & 0 deletions tests/multiply_half.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
static const half kFactor = 2.h;

half computeOutputValue(TensorView<half> A, uint2 loc)
{
return A[loc] * kFactor;
}

[CudaKernel]
void mul_kernel(TensorView<half> A, TensorView<half> result)
{
uint2 location = (cudaBlockDim() * cudaBlockIdx() + cudaThreadIdx()).xy;
result[location] = computeOutputValue(A, location);
}

[TorchEntryPoint]
TorchTensor<half> multiply(TorchTensor<half> A)
{
var result = TorchTensor<half>.zerosLike(A);
let blockCount = uint3(1);
let groupSize = uint3(A.size(0), A.size(1), 1);

__dispatch_kernel(mul_kernel, blockCount, groupSize)(A, result);
return result;
}

0 comments on commit 695bc9f

Please sign in to comment.