Open chhzh123 opened 4 years ago
In this example, the 0th dimension of A is useless, since it only has size 1.
A
def test_multidimensional_array(): hcl.init() A = hcl.placeholder((1, 100), "A") def kernel(A): B = hcl.compute(A.shape, lambda x, y: A[x, y] + 1, "B") return B s = hcl.create_schedule([A], kernel) target = hcl.platform.zc706 target.config(compile="vivado_hls",mode="csim") f = hcl.build(s, target=target) hcl_A = hcl.asarray(np.zeros((1,100))) hcl_B = hcl.asarray(np.zeros((1,100))) f(hcl_A,hcl_B)
The generated code outputs a constant as a placeholder. However, A and B can be both optimized to 1D arrays.
B
void test(bit32 B[1][100], bit32 A[1][100]) { B_y: for (bit32 y = 0; y < 100; ++y) { B[0][y] = (A[0][y] + 1); } }
In this example, the 0th dimension of
A
is useless, since it only has size 1.The generated code outputs a constant as a placeholder. However,
A
andB
can be both optimized to 1D arrays.