cornell-zhang / heterocl

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

[Testing] Add test cases for issues related to data movement #357

Closed hecmay closed 3 years ago

hecmay commented 3 years ago

Issues on deprecated features

Issues already fixed in #332

Issues/requests for new features

hecmay commented 3 years ago

The range of max_id in digitrec is not known until runtime, so the ExtractIndices is not able to restore the multi-dimensional indices we want even if the Mod expression is simplified...

Here is the index I got after updating Simplify @seanlatias

knn_mat_on_device[(((max_id - (max_id % (ap_uint<49>)3)) + x1][(max_id % (ap_uint<49>)3)]
hecmay commented 3 years ago

I was mistaken... this PR did not introduce the fix for #194 and issue #261. I just removed that from the description. Will add that part in a separate PR.

I added test cases for #276 and #270.

hecmay commented 3 years ago

I did not find a good way to fix the #276. Simply returning mod_op->a will cause an issue for the loop fusion test case. The originally expected output for the loop fusion test case is

for (x_fused, 0, 100)
  B[x_fused/10][x_fused%10] = ...

But if we over-simplify the mod operator, the generated output would be

for (x_fused, 0, 100)
  B[0][x_fused] = ...

A workaround to fix #276 (without breaking the fusion test case) is to update the itervar's range map. but I guess maybe we can just leave as it is and fix it when we introduce multi-dim representation in MLIR? @seanlatias

But right now, at least for digitrec and kmeans, we can generated expected multi-dim array.

seanlatias commented 3 years ago

Just leave it then. That's one reason I did not quote #276.