Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixbug] Fix dynamic memcpy bug #427

Merged
merged 2 commits into from
Feb 21, 2024
Merged

Conversation

KTong821
Copy link
Contributor

@KTong821 KTong821 commented Feb 20, 2024

Minimal failure case:

resize_inputs: Tensor = symbol([1, 3, "h", "w"], dtype="int32", device="cpu")
resize_outputs = self.resize(resize_inputs.to(self.dtype, self.device))  # (float32, cuda)
resize_graph: FlowGraph = trace_from(resize_outputs, resize_inputs)

resize_graph.build()

compiles this launch where symbols h and w are undefined.

DLL void hidet_launch_0(float * __restrict__ x, float * __restrict__ y) {
  cudaMemcpyAsync(y, x, (4 * ((3 * h) * w)), cudaMemcpyHostToDevice, (cudaStream_t)get_cuda_stream());
}

Fix is to add exprs to BlackBoxStmt so that symbols defined in exprs can be visited during codegen.

@yaoyaoding yaoyaoding changed the title Fix dynamic memcpy bug [Fixbug] Fix dynamic memcpy bug Feb 21, 2024
@yaoyaoding
Copy link
Member

Thanks @KTong821 !

@yaoyaoding yaoyaoding merged commit f3ccb87 into hidet-org:main Feb 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants