Add comments with kernel names to AUB files

Related-To: NEO-2783

Change-Id: Ib00e969b106301d712dc4c14af8208456bcabdb3
Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2019-04-16 14:39:40 +02:00
committed by sys_ocldev
parent 1d42fe169a
commit c6247873f5
4 changed files with 49 additions and 0 deletions

View File

@@ -184,6 +184,13 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
enqueueHandlerHook(commandType, multiDispatchInfo);
if (getCommandStreamReceiver().getType() > CommandStreamReceiverType::CSR_HW) {
if (!multiDispatchInfo.empty()) {
auto kernelName = multiDispatchInfo.peekMainKernel()->getKernelInfo().name;
getCommandStreamReceiver().addAubComment(kernelName.c_str());
}
}
if (DebugManager.flags.AUBDumpSubCaptureMode.get()) {
getCommandStreamReceiver().activateAubSubCapture(multiDispatchInfo);
}

View File

@@ -34,6 +34,37 @@ HWTEST_F(EnqueueHandlerTest, enqueueHandlerWithKernelCallsProcessEvictionOnCSR)
EXPECT_TRUE(csr->processEvictionCalled);
}
HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithKernelWhenAubCsrIsActiveThenAddCommentWithKernelName) {
int32_t tag;
auto aubCsr = new MockCsrAub<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(aubCsr);
MockKernelWithInternals mockKernel(*pDevice);
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(context, pDevice, 0));
size_t gws[] = {1, 1, 1};
mockKernel.kernelInfo.name = "kernel_name";
mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
EXPECT_TRUE(aubCsr->addAubCommentCalled);
EXPECT_STREQ("kernel_name", aubCsr->aubCommentMessage.c_str());
}
HWTEST_F(EnqueueHandlerTest, givenEnqueueHandlerWithEmptyDispatchInfoWhenAubCsrIsActiveThenDontAddCommentWithKernelName) {
int32_t tag;
auto aubCsr = new MockCsrAub<FamilyType>(tag, *pDevice->executionEnvironment);
pDevice->resetCommandStreamReceiver(aubCsr);
MockKernelWithInternals mockKernel(*pDevice);
auto mockCmdQ = std::unique_ptr<MockCommandQueueHw<FamilyType>>(new MockCommandQueueHw<FamilyType>(context, pDevice, 0));
size_t gws[] = {0, 0, 0};
mockKernel.kernelInfo.name = "kernel_name";
mockCmdQ->enqueueKernel(mockKernel.mockKernel, 1, nullptr, gws, nullptr, 0, nullptr, nullptr);
EXPECT_FALSE(aubCsr->addAubCommentCalled);
}
template <typename GfxFamily>
class MyCommandQueueHw : public CommandQueueHw<GfxFamily> {
typedef CommandQueueHw<GfxFamily> BaseClass;

View File

@@ -144,6 +144,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
}
void addAubComment(const char *message) override {
CommandStreamReceiverHw<GfxFamily>::addAubComment(message);
aubCommentMessage.assign(message);
addAubCommentCalled = true;
}
void flushBatchedSubmissions() override {
@@ -165,6 +166,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
bool recordFlusheBatchBuffer = false;
bool activateAubSubCaptureCalled = false;
bool addAubCommentCalled = false;
std::string aubCommentMessage = "";
bool flushBatchedSubmissionsCalled = false;
uint32_t makeSurfacePackNonResidentCalled = false;
bool initProgrammingFlagsCalled = false;

View File

@@ -94,6 +94,15 @@ class MockCsrBase : public UltCommandStreamReceiver<GfxFamily> {
template <typename GfxFamily>
using MockCsrHw = MockCsrBase<GfxFamily>;
template <typename GfxFamily>
class MockCsrAub : public MockCsrBase<GfxFamily> {
public:
MockCsrAub(int32_t &execStamp, ExecutionEnvironment &executionEnvironment) : MockCsrBase<GfxFamily>(execStamp, executionEnvironment) {}
CommandStreamReceiverType getType() override {
return CommandStreamReceiverType::CSR_AUB;
}
};
template <typename GfxFamily>
class MockCsr : public MockCsrBase<GfxFamily> {
public: