mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
fix: re-add switch case for once writable query
A change related to the tbx fault manager incorrectly removed a switch case from `AubHelper::isOneTimeAubWritableAllocationType`. This fixes that and refactors some APIs to prevent similar mistakes from happening again by cleaning up logic. Addresses show stopper for pre-si pytorch workflows. Resolves: NEO-14399 Signed-off-by: Jack Myers <jack.myers@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2e729bcb4c
commit
0e25970853
@@ -41,8 +41,10 @@ bool AubHelper::isOneTimeAubWritableAllocationType(const AllocationType &type) {
|
||||
case AllocationType::assertBuffer:
|
||||
case AllocationType::tagBuffer:
|
||||
case AllocationType::syncDispatchToken:
|
||||
return true;
|
||||
case AllocationType::bufferHostMemory:
|
||||
return (NEO::debugManager.flags.SetBufferHostMemoryAlwaysAubWritable.get() ? false : true) || (NEO::debugManager.flags.EnableTbxPageFaultManager.get() == 1);
|
||||
return NEO::debugManager.isTbxPageFaultManagerEnabled() ||
|
||||
(NEO::debugManager.flags.SetBufferHostMemoryAlwaysAubWritable.get() == false);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,9 @@ TbxCommandStreamReceiverHw<GfxFamily>::~TbxCommandStreamReceiverHw() {
|
||||
template <typename GfxFamily>
|
||||
bool TbxCommandStreamReceiverHw<GfxFamily>::isAllocTbxFaultable(GraphicsAllocation *gfxAlloc) {
|
||||
// indicates host memory not managed by the driver
|
||||
if (gfxAlloc->getDriverAllocatedCpuPtr() == nullptr || !debugManager.isTbxPageFaultManagerEnabled() || this->getTbxPageFaultManager() == nullptr) {
|
||||
if ((gfxAlloc->getDriverAllocatedCpuPtr() == nullptr) ||
|
||||
(debugManager.isTbxPageFaultManagerEnabled() == false) ||
|
||||
(this->getTbxPageFaultManager() == nullptr)) {
|
||||
return false;
|
||||
}
|
||||
auto allocType = gfxAlloc->getAllocationType();
|
||||
|
||||
@@ -162,9 +162,10 @@ class DebugSettingsManager : NEO::NonCopyableAndNonMovableClass {
|
||||
|
||||
inline bool isTbxPageFaultManagerEnabled() {
|
||||
auto setCsr = flags.SetCommandStreamReceiver.get();
|
||||
auto tbxMngrFlag = flags.EnableTbxPageFaultManager.get();
|
||||
auto isTbxMode = (setCsr == static_cast<int32_t>(CommandStreamReceiverType::tbx)) || (setCsr == static_cast<int32_t>(CommandStreamReceiverType::tbxWithAub));
|
||||
return tbxMngrFlag && isTbxMode;
|
||||
auto isTbxMode = (setCsr == static_cast<int32_t>(CommandStreamReceiverType::tbx)) ||
|
||||
(setCsr == static_cast<int32_t>(CommandStreamReceiverType::tbxWithAub));
|
||||
auto isFaultManagerEnabledInEnvVars = flags.EnableTbxPageFaultManager.get();
|
||||
return isFaultManagerEnabledInEnvVars && isTbxMode;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -129,9 +129,10 @@ TEST(AubHelper, givenAllocationTypeWhenAskingIfOneTimeWritableThenReturnCorrectR
|
||||
}
|
||||
}
|
||||
|
||||
TEST(AubHelper, givenSetBufferHostMemoryAlwaysAubWritableAndDisabledTbxFaultMngrWhenAskingIfBufferHostMemoryAllocationIsOneTimeAubWritableThenReturnCorrectResult) {
|
||||
TEST(AubHelper, givenAlwaysAubWritableAndEnableTbxFaultManagerSetExternallyThenAllocationIsOneTimeAubWritableShouldReturnCorrectResult) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
NEO::debugManager.flags.EnableTbxPageFaultManager.set(0);
|
||||
NEO::debugManager.flags.SetCommandStreamReceiver.set(2);
|
||||
|
||||
for (auto isAlwaysAubWritable : {false, true}) {
|
||||
for (auto isTbxFaultManagerEnabled : {false, true}) {
|
||||
|
||||
Reference in New Issue
Block a user