Updated python and cpp end to end test and readme to show support for different types on tensor
This commit is contained in:
parent
6a7f410675
commit
8abb2313d0
4 changed files with 39 additions and 27 deletions
|
|
@ -36,8 +36,9 @@ def test_end_to_end():
|
|||
|
||||
tensor_in_a = mgr.tensor([2, 2, 2])
|
||||
tensor_in_b = mgr.tensor([1, 2, 3])
|
||||
tensor_out_a = mgr.tensor([0, 0, 0])
|
||||
tensor_out_b = mgr.tensor([0, 0, 0])
|
||||
# Explicit type constructor supports int, in32, double, float and int
|
||||
tensor_out_a = mgr.tensor_t(np.array([0, 0, 0], dtype=np.uint32))
|
||||
tensor_out_b = mgr.tensor_t(np.array([0, 0, 0], dtype=np.uint32))
|
||||
|
||||
params = [tensor_in_a, tensor_in_b, tensor_out_a, tensor_out_b]
|
||||
|
||||
|
|
@ -49,8 +50,8 @@ def test_end_to_end():
|
|||
// The input tensors bind index is relative to index in parameter passed
|
||||
layout(set = 0, binding = 0) buffer buf_in_a { float in_a[]; };
|
||||
layout(set = 0, binding = 1) buffer buf_in_b { float in_b[]; };
|
||||
layout(set = 0, binding = 2) buffer buf_out_a { float out_a[]; };
|
||||
layout(set = 0, binding = 3) buffer buf_out_b { float out_b[]; };
|
||||
layout(set = 0, binding = 2) buffer buf_out_a { uint out_a[]; };
|
||||
layout(set = 0, binding = 3) buffer buf_out_b { uint out_b[]; };
|
||||
|
||||
// Kompute supports push constants updated on dispatch
|
||||
layout(push_constant) uniform PushConstants {
|
||||
|
|
@ -62,8 +63,8 @@ def test_end_to_end():
|
|||
|
||||
void main() {
|
||||
uint index = gl_GlobalInvocationID.x;
|
||||
out_a[index] += in_a[index] * in_b[index];
|
||||
out_b[index] += const_one * push_const.val;
|
||||
out_a[index] += uint( in_a[index] * in_b[index] );
|
||||
out_b[index] += uint( const_one * push_const.val );
|
||||
}
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue