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

L0: Graph kernel nodes targeting the same kernel overwrite other one's arguments #782

Open
linehill opened this issue Feb 23, 2024 · 0 comments
Milestone

Comments

@linehill
Copy link
Collaborator

The reproducer:

#include <hip/hip_runtime.h>
__global__ void k(int Val) { printf("Val=%d\n", Val); }

int main() {

  int A0 = 123, A1 = 321;
  void *K0Args[] = {&A0};
  void *K1Args[] = {&A1};

  hipKernelNodeParams K0Params;
  K0Params.func = (void *)k;
  K0Params.gridDim = dim3(1);
  K0Params.blockDim = dim3(1);
  K0Params.sharedMemBytes = 0;
  K0Params.kernelParams = K0Args;
  K0Params.extra = nullptr;

  hipKernelNodeParams K1Params = K0Params;
  K1Params.kernelParams = K1Args;

  hipGraph_t Graph;
  (void)hipGraphCreate(&Graph, 0);

  hipGraphNode_t KN0, KN1;
  (void)hipGraphAddKernelNode(&KN0, Graph, nullptr, 0, &K0Params);
  (void)hipGraphAddKernelNode(&KN1, Graph, nullptr, 0, &K1Params);

  hipGraphExec_t GraphExec;
  (void)hipGraphInstantiate(&GraphExec, Graph, nullptr, nullptr, 0);
  (void)hipGraphLaunch(GraphExec, 0);
  (void)hipDeviceSynchronize();

  return 0;
}

Level0 backend produces incorrect output:

$ ./repro 


Val=321
Val=321

OpenCL backend produces the expected output (order may vary):

$ ./repro 


Val=123
Val=321
@pvelesko pvelesko added this to the Release 1.3 milestone May 29, 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

No branches or pull requests

2 participants