0e8da085bf
If in source CUDA file main header (cuda_runtime.h or cuda.h) is not presented, corresponding HIP main header (hip_runtime.h) should be explicitly included in output hipified file.
[Algorithm]
1. If #pragma once is presented, HIP main header should be placed just after it;
2. Otherwise if any other (not CUDA main) header is presented, HIP main header should be placed just before it;
3. Otherwise HIP main header should be placed in the beginning of output file.
P.S.
There might be one more situation when #ifndef #define ... #endif guard for the entire file is presented (make sense for *.h, *.hpp, *.cuh files). In this case HIP main include should be placed just after such #ifdef, or after #pragma once, if it is also presented. This situation will be handled in a separate change.
[ROCm/hip commit: 09655a0853]
13 satır
240 B
Plaintext
13 satır
240 B
Plaintext
// RUN: %run_test hipify "%s" "%t" %cuda_args
|
|
|
|
// CHECK: #pragma once
|
|
// CHECK-NEXT: #include <hip/hip_runtime.h>
|
|
#pragma once
|
|
// CHECK-NOT: #include <hip/hip_runtime.h>
|
|
#include <stdio.h>
|
|
|
|
int main(int argc, char* argv[]) {
|
|
return 0;
|
|
}
|
|
|