Skip to content

Commit 3cee589 leads to an application error #1217

@colleeneb

Description

@colleeneb

3cee589 broke some code. (Thanks to Aurora CI for catching!)
A reproducer of the issue is below. The change away from always returning hipStreamCaptureStatusNone breaks codes that use patterns like:

    hipStreamWaitEvent(stream2, event, 0);
    hipStreamSynchronize(stream2);

hipStreamWaitEvent changes CaptureStatus_ to hipStreamCaptureStatusActive if it was previously hipStreamCaptureStatusNone. :

ChipQueue->setCaptureStatus(hipStreamCaptureStatusActive);

hipStreamSynchronize will error out if CaptureStatus_ does not equal hipStreamCaptureStatusNone:
if (ChipQueue->getCaptureStatus() != hipStreamCaptureStatusNone) {

It worked previously since getCaptureStatus was hard-coded to return hipStreamCaptureStatusNone so hipStreamSynchronize didn't error out.

Reproducer:

#include <hip/hip_runtime.h>
#include <stdio.h>

  #define CHECK(cmd) \
    do { \
      hipError_t e = (cmd); \
      if (e != hipSuccess) { \
        fprintf(stderr, "HIP error %s:%d: %s\n", __FILE__, __LINE__, hipGetErrorString(e)); \
        exit(1); \
      } \
    } while (0)

  int main() {
    hipStream_t stream1, stream2;
    hipEvent_t event;
    CHECK(hipStreamCreate(&stream1));
    CHECK(hipStreamCreate(&stream2));
    CHECK(hipEventCreate(&event));

    CHECK(hipEventRecord(event, stream1));
    CHECK(hipStreamWaitEvent(stream2, event, 0));
    CHECK(hipStreamSynchronize(stream2));

    // cleanup                                                                                                                                                                                                                   
    CHECK(hipDeviceSynchronize());
    CHECK(hipEventDestroy(event));
    CHECK(hipStreamDestroy(stream1));
    CHECK(hipStreamDestroy(stream2));
    return 0;
  }

Compile:

> hipcc t.cpp

Run

> ./a.out
HIP error t.cpp:22: hipErrorUnknown

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions