Skip to content

[Fixbug] Fix dynamic memcpy bug#427

Merged
yaoyaoding merged 2 commits intohidet-org:mainfrom
KTong821:dynamic-memcpy
Feb 21, 2024
Merged

[Fixbug] Fix dynamic memcpy bug#427
yaoyaoding merged 2 commits intohidet-org:mainfrom
KTong821:dynamic-memcpy

Conversation

@KTong821
Copy link
Copy Markdown
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
Copy Markdown
Member

Thanks @KTong821 !

@yaoyaoding yaoyaoding merged commit f3ccb87 into hidet-org:main Feb 21, 2024
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.

2 participants