Skip to content

Commit 914561a

Browse files
[SYCL] Fix dependency compilation after PI removal (#14843)
1 parent 41d8977 commit 914561a

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,14 +1507,9 @@ ProgramManager::ProgramPtr ProgramManager::build(
15071507
LinkPrograms.push_back(Program.get());
15081508

15091509
for (ur_program_handle_t Prg : ExtraProgramsToLink) {
1510-
auto Result =
1511-
Plugin->call_nocheck(urProgramCompileExp, Prg, /* num devices =*/1,
1512-
&Device, CompileOptions.c_str());
1513-
if (Result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) {
1514-
Plugin->call(urProgramCompile, Context->getHandleRef(), Prg,
1515-
CompileOptions.c_str());
1516-
}
1517-
Plugin->checkUrResult(Result);
1510+
auto Res = doCompile(Plugin, Prg, /*num devices =*/1, &Device,
1511+
Context->getHandleRef(), CompileOptions.c_str());
1512+
Plugin->checkUrResult(Res);
15181513

15191514
LinkPrograms.push_back(Prg);
15201515
}

sycl/unittests/program_manager/DynamicLinking.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,30 @@ TEST(DynamicLinking, AheadOfTime) {
197197
}
198198
}
199199

200+
static ur_result_t redefined_urProgramCompileExp(void *pParams) {
201+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
202+
}
203+
204+
TEST(DynamicLinking, UnsupportedCompileExp) {
205+
sycl::unittest::UrMock<> Mock;
206+
setupRuntimeLinkingMock();
207+
mock::getCallbacks().set_replace_callback("urProgramCompileExp",
208+
redefined_urProgramCompileExp);
209+
210+
sycl::platform Plt = sycl::platform();
211+
sycl::queue Q(Plt.get_devices()[0]);
212+
213+
CapturedLinkingData.clear();
214+
215+
Q.single_task<DynamicLinkingTest::BasicCaseKernel>([=]() {});
216+
ASSERT_EQ(CapturedLinkingData.NumOfUrProgramCreateCalls, 3u);
217+
// Both programs should be linked together.
218+
ASSERT_EQ(CapturedLinkingData.NumOfUrProgramLinkCalls, 1u);
219+
ASSERT_TRUE(CapturedLinkingData.LinkedProgramsContains(
220+
{BASIC_CASE_PRG, BASIC_CASE_PRG_DEP, BASIC_CASE_PRG_DEP_DEP}));
221+
// And the linked program should be used to create a kernel.
222+
ASSERT_EQ(CapturedLinkingData.ProgramUsedToCreateKernel,
223+
BASIC_CASE_PRG * BASIC_CASE_PRG_DEP * BASIC_CASE_PRG_DEP_DEP);
224+
}
225+
200226
} // anonymous namespace

0 commit comments

Comments
 (0)