Skip to content

Commit 7436827

Browse files
nrspruitomarahmed1111
authored andcommitted
Fix Native Device Init
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent cd4b111 commit 7436827

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

source/adapters/level_zero/program.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
8484
ur_program_handle_t
8585
*Program ///< [out] pointer to handle of Program object created.
8686
) {
87-
std::ignore = Device;
88-
std::ignore = Properties;
8987
// In OpenCL, clCreateProgramWithBinary() can be used to load any of the
9088
// following: "program executable", "compiled program", or "library of
9189
// compiled programs". In addition, the loaded program can be either
@@ -99,7 +97,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary(
9997

10098
try {
10199
ur_program_handle_t_ *UrProgram = new ur_program_handle_t_(
102-
ur_program_handle_t_::Native, Context, Binary, Size);
100+
ur_program_handle_t_::Native, Context, Device, Properties, Binary, Size);
103101
*Program = reinterpret_cast<ur_program_handle_t>(UrProgram);
104102
} catch (const std::bad_alloc &) {
105103
return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;

source/adapters/level_zero/program.hpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct ur_program_handle_t_ : _ur_object {
6565
ze_module_constants_t ZeSpecConstants;
6666
};
6767

68-
// Construct a program in IL or Native state.
68+
// Construct a program in IL.
6969
ur_program_handle_t_(state St, ur_context_handle_t Context, const void *Input,
7070
size_t Length)
7171
: Context{Context},
@@ -74,6 +74,15 @@ struct ur_program_handle_t_ : _ur_object {
7474
std::memcpy(Code.get(), Input, Length);
7575
}
7676

77+
// Construct a program in NATIVE.
78+
ur_program_handle_t_(state St, ur_context_handle_t Context, ur_device_handle_t Device, const ur_program_properties_t *Properties, const void *Input,
79+
size_t Length)
80+
: Context{Context}, NativeDevice(Device), NativeProperties(Properties),
81+
OwnZeModule{true}, State{St}, Code{new uint8_t[Length]},
82+
CodeLength{Length}, ZeModule{nullptr}, ZeBuildLog{nullptr} {
83+
std::memcpy(Code.get(), Input, Length);
84+
}
85+
7786
// Construct a program in Exe or Invalid state.
7887
ur_program_handle_t_(state St, ur_context_handle_t Context,
7988
ze_module_handle_t ZeModule,
@@ -108,6 +117,13 @@ struct ur_program_handle_t_ : _ur_object {
108117

109118
const ur_context_handle_t Context; // Context of the program.
110119

120+
121+
// Device Handle used for the Native Build
122+
ur_device_handle_t NativeDevice;
123+
124+
// Properties used for the Native Build
125+
const ur_program_properties_t *NativeProperties;
126+
111127
// Indicates if we own the ZeModule or it came from interop that
112128
// asked to not transfer the ownership to SYCL RT.
113129
const bool OwnZeModule;

0 commit comments

Comments
 (0)