File tree Expand file tree Collapse file tree 4 files changed +38
-3
lines changed
Expand file tree Collapse file tree 4 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -979,6 +979,12 @@ std::optional<HeaderType> DpctFileInfo::findHeaderType(StringRef Header) {
979979}
980980
981981void DpctFileInfo::insertHeader (HeaderType Type, unsigned Offset) {
982+ if (Type == HT_DPL_Algorithm || Type == HT_DPL_Execution ||
983+ Type == HT_DPCT_DNNL_Utils) {
984+ if (this != DpctGlobalInfo::getInstance ().getMainFile ().get ())
985+ DpctGlobalInfo::getInstance ().getMainFile ()->insertHeader (
986+ Type, FirstIncludeOffset);
987+ }
982988 if (HeaderInsertedBitMap[Type])
983989 return ;
984990 HeaderInsertedBitMap[Type] = true ;
@@ -996,9 +1002,6 @@ void DpctFileInfo::insertHeader(HeaderType Type, unsigned Offset) {
9961002 case HT_DPL_Algorithm:
9971003 case HT_DPL_Execution:
9981004 case HT_DPCT_DNNL_Utils:
999- if (this != DpctGlobalInfo::getInstance ().getMainFile ().get ())
1000- DpctGlobalInfo::getInstance ().getMainFile ()->insertHeader (
1001- Type, FirstIncludeOffset);
10021005 concatHeader (OS, getHeaderSpelling (Type));
10031006 return insertHeader (OS.str (), FirstIncludeOffset,
10041007 InsertPosition::IP_AlwaysLeft);
Original file line number Diff line number Diff line change 1+ // RUN: echo
2+ // CHECK: #include <dpct/dnnl_utils.hpp>
3+ // CHECK: #include <sycl/sycl.hpp>
4+ // CHECK: #include <dpct/dpct.hpp>
5+ #include " dnn.h"
6+
7+ int test (cudnnHandle_t handle){
8+
9+ cudnnCreate (&handle);
10+ return 0 ;
11+
12+ }
Original file line number Diff line number Diff line change 1+ #include <cudnn.h>
2+
3+ int test (cudnnHandle_t handle );
Original file line number Diff line number Diff line change 1+ // RUN: dpct -in-root %S -out-root %T/header_order %S/test.cu %S/dnn.cu --cuda-include-path="%cuda-path/include" -- -std=c++14 -x cuda --cuda-host-only
2+ // RUN: FileCheck --input-file %T/header_order/test.dp.cpp --match-full-lines %s
3+ // RUN: FileCheck --input-file %T/header_order/dnn.dp.cpp --match-full-lines %s
4+ // CHECK: #include <dpct/dnnl_utils.hpp>
5+ // CHECK: #include <sycl/sycl.hpp>
6+ // CHECK: #include <dpct/dpct.hpp>
7+ #include < stdlib.h>
8+ #include < iostream>
9+ #include < algorithm>
10+
11+ #include " dnn.h"
12+
13+ int main (){
14+ cudnnHandle_t handle;
15+ test (handle);
16+ return 0 ;
17+ }
You can’t perform that action at this time.
0 commit comments