cornell-zhang / heterocl

HeteroCL: A Multi-Paradigm Programming Infrastructure for Software-Defined Heterogeneous Computing
https://cornell-zhang.github.io/heterocl/
Apache License 2.0
326 stars 92 forks source link

hcl.print prints tensors with indices in reverse order (as if transposed) #408

Closed jcasas00 closed 3 years ago

jcasas00 commented 3 years ago

Code:

def test (DRAM):
    hcl.print ((), f"DRAM: {DRAM.shape} {DRAM.dtype}\n")
    hcl.print(DRAM)

DRAM    = hcl.placeholder((4,2), "dram", dtype=hcl.UInt(64))
s = hcl.create_schedule([DRAM], test)
f = hcl.build(s)
dram    = hcl.asarray (np.zeros(DRAM.shape), dtype=DRAM.dtype)
print (dram)

Output:

[[0 0]                             # output of print(dram) which correctly looks like (4,2)
 [0 0]
 [0 0]
 [0 0]]
DRAM: (4, 2) uint64  
[[0, 0, 0, 0],                    # output of hcl.print which makes it look like (2,4)
[0, 0, 0, 0]]
seanlatias commented 3 years ago

Please check #409

jcasas00 commented 3 years ago

Tested latest master and it looks good now. Thanks.