mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Fix max root device index in Program's ctor
Related-To: NEO-5001 Change-Id: If3b86a51df478222f47a30c9254466dea0710ec4 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
52feced02b
commit
4122554b71
@ -48,7 +48,13 @@ Program::Program(Context *context, bool isBuiltIn, const ClDeviceVector &clDevic
|
||||
numDevices = static_cast<uint32_t>(clDevicesIn.size());
|
||||
bool force32BitAddressess = false;
|
||||
|
||||
uint32_t maxRootDeviceIndex = pDevice->getRootDeviceIndex();
|
||||
uint32_t maxRootDeviceIndex = 0;
|
||||
|
||||
for (const auto &device : clDevicesIn) {
|
||||
if (device->getRootDeviceIndex() > maxRootDeviceIndex) {
|
||||
maxRootDeviceIndex = device->getRootDeviceIndex();
|
||||
}
|
||||
}
|
||||
|
||||
buildInfos.resize(maxRootDeviceIndex + 1);
|
||||
|
||||
|
@ -3053,6 +3053,29 @@ TEST_F(ProgramMultiRootDeviceTests, WhenPrivateSurfaceIsCreatedThenItHasCorrectR
|
||||
EXPECT_EQ(expectedRootDeviceIndex, privateSurface->getRootDeviceIndex());
|
||||
}
|
||||
|
||||
TEST_F(ProgramMultiRootDeviceTests, WhenProgramIsCreatedThenBuildInfosVectorIsProperlyResized) {
|
||||
{
|
||||
ClDeviceVector deviceVector;
|
||||
deviceVector.push_back(device.get());
|
||||
deviceVector.push_back(device2.get());
|
||||
|
||||
EXPECT_EQ(1u, deviceVector[0]->getRootDeviceIndex());
|
||||
auto program = std::make_unique<MockProgram>(context.get(), false, deviceVector);
|
||||
|
||||
EXPECT_EQ(3u, program->buildInfos.size());
|
||||
}
|
||||
{
|
||||
ClDeviceVector deviceVector;
|
||||
deviceVector.push_back(device2.get());
|
||||
deviceVector.push_back(device.get());
|
||||
|
||||
EXPECT_EQ(2u, deviceVector[0]->getRootDeviceIndex());
|
||||
auto program = std::make_unique<MockProgram>(context.get(), false, deviceVector);
|
||||
|
||||
EXPECT_EQ(3u, program->buildInfos.size());
|
||||
}
|
||||
}
|
||||
|
||||
class MockCompilerInterfaceWithGtpinParam : public CompilerInterface {
|
||||
public:
|
||||
TranslationOutput::ErrorCode link(
|
||||
|
Reference in New Issue
Block a user