Skip to content

Commit 76b8f62

Browse files
Move noop programming to dedicated encoder
Signed-off-by: Zbigniew Zdanowicz <[email protected]>
1 parent 6d85028 commit 76b8f62

File tree

15 files changed

+115
-80
lines changed

15 files changed

+115
-80
lines changed

opencl/test/unit_test/aub_tests/command_stream/aub_command_stream_tests.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "shared/source/command_container/command_encoder.h"
89
#include "shared/source/command_stream/aub_command_stream_receiver_hw.h"
910
#include "shared/source/command_stream/command_stream_receiver_hw.h"
1011
#include "shared/source/helpers/ptr_math.h"
@@ -58,7 +59,7 @@ struct AUBFixture : public AUBCommandStreamFixture,
5859
*pCmd++ = noop;
5960

6061
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(*pCS, nullptr);
61-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(*pCS);
62+
EncodeNoop<FamilyType>::alignToCacheLine(*pCS);
6263
BatchBuffer batchBuffer{pCS->getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, pCS->getUsed(), pCS, nullptr, false};
6364
ResidencyContainer allocationsForResidency;
6465
pCommandStreamReceiver->flush(batchBuffer, allocationsForResidency);
@@ -73,7 +74,7 @@ typedef Test<AUBFixture> AUBcommandstreamTests;
7374

7475
HWTEST_F(AUBcommandstreamTests, WhenFlushingTwiceThenCompletes) {
7576
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(*pCS, nullptr);
76-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(*pCS);
77+
EncodeNoop<FamilyType>::alignToCacheLine(*pCS);
7778
BatchBuffer batchBuffer{pCS->getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, pCS->getUsed(), pCS, nullptr, false};
7879
ResidencyContainer allocationsForResidency;
7980

opencl/test/unit_test/command_stream/command_stream_receiver_hw_1_tests.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "shared/source/command_container/command_encoder.h"
89
#include "shared/source/command_stream/scratch_space_controller.h"
910
#include "shared/source/command_stream/scratch_space_controller_base.h"
1011
#include "shared/source/helpers/constants.h"
@@ -486,14 +487,6 @@ HWTEST_F(CommandStreamReceiverFlushTests, WhenAddingBatchBufferEndThenBatchBuffe
486487
ptrOffset(commandStream.getCpuBase(), usedPrevious));
487488
EXPECT_NE(nullptr, batchBufferEnd);
488489
}
489-
490-
HWTEST_F(CommandStreamReceiverFlushTests, WhenAligningCommandStreamReceiverToCacheLineSizeThenItIsAlignedCorrectly) {
491-
commandStream.getSpace(sizeof(uint32_t));
492-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(commandStream);
493-
494-
EXPECT_EQ(0u, commandStream.getUsed() % MemoryConstants::cacheLineSize);
495-
}
496-
497490
typedef Test<ClDeviceFixture> CommandStreamReceiverHwTest;
498491

499492
HWTEST_F(CommandStreamReceiverHwTest, givenCsrHwWhenTypeIsCheckedThenCsrHwIsReturned) {

opencl/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "shared/source/command_container/command_encoder.h"
89
#include "shared/source/command_stream/preemption.h"
910
#include "shared/source/direct_submission/linux/drm_direct_submission.h"
1011
#include "shared/source/gmm_helper/gmm_helper.h"
@@ -179,7 +180,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, WhenFlushingThenAvailableSpaceDoesNotCh
179180
EXPECT_EQ(boHandle, commandBuffer->getBO()->peekHandle());
180181

181182
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
182-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
183+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
183184
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
184185
auto availableSpacePriorToFlush = cs.getAvailableSpace();
185186
csr->flush(batchBuffer, csr->getResidencyAllocations());
@@ -194,7 +195,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPrintIndicesEnabledWhenFlushThenPr
194195

195196
auto &cs = csr->getCS();
196197
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
197-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
198+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
198199
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
199200

200201
::testing::internal::CaptureStdout();
@@ -245,7 +246,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdT
245246
auto &cs = csr->getCS();
246247

247248
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
248-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
249+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
249250
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
250251
csr->flush(batchBuffer, csr->getResidencyAllocations());
251252

@@ -280,7 +281,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenLowPriorityContextWhenFlushingThen
280281
ASSERT_EQ(0u, reinterpret_cast<uintptr_t>(commandBuffer->getUnderlyingBuffer()) & 0xFFF);
281282

282283
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
283-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
284+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
284285
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, true, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
285286
csr->flush(batchBuffer, csr->getResidencyAllocations());
286287
EXPECT_NE(cs.getCpuBase(), nullptr);
@@ -309,7 +310,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenInvalidAddressWhenFlushingThenSucc
309310
LinearStream cs(&commandBufferAllocation);
310311

311312
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
312-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
313+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
313314
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
314315
csr->flush(batchBuffer, csr->getResidencyAllocations());
315316
delete[] commandBuffer;
@@ -340,7 +341,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotEmptyBbWhenFlushingThenSucceeds
340341
cs.getSpace(bbUsed);
341342

342343
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
343-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
344+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
344345
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
345346
csr->flush(batchBuffer, csr->getResidencyAllocations());
346347
}
@@ -369,7 +370,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotEmptyNotPaddedBbWhenFlushingThe
369370
cs.getSpace(bbUsed);
370371

371372
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
372-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
373+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
373374
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
374375
csr->flush(batchBuffer, csr->getResidencyAllocations());
375376
}
@@ -399,7 +400,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenNotAlignedWhenFlushingThenSucceeds
399400
.Times(2);
400401

401402
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
402-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
403+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
403404

404405
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
405406
csr->flush(batchBuffer, csr->getResidencyAllocations());
@@ -448,7 +449,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckFlagsWhenFlushingThenSucceeds
448449
csr->makeResident(allocation);
449450
csr->makeResident(allocation2);
450451
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
451-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
452+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
452453
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
453454
csr->flush(batchBuffer, csr->getResidencyAllocations());
454455
}
@@ -481,7 +482,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeWhenFlushingThenSuccee
481482

482483
csr->makeResident(allocation);
483484
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
484-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
485+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
485486
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
486487
csr->flush(batchBuffer, csr->getResidencyAllocations());
487488
}
@@ -522,7 +523,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenCheckDrmFreeCloseFailedWhenFlushin
522523

523524
csr->makeResident(allocation);
524525
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
525-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
526+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
526527
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
527528
csr->flush(batchBuffer, csr->getResidencyAllocations());
528529
}
@@ -553,7 +554,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenFlushIsCalledThenP
553554

554555
csr->makeResident(*dummyAllocation);
555556
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
556-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
557+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
557558

558559
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
559560
csr->flush(batchBuffer, csr->getResidencyAllocations());
@@ -772,7 +773,7 @@ struct MockDrmBlitterDirectSubmission : public DrmDirectSubmission<GfxFamily, Bl
772773
HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmissionWhenFlushThenFlushStampIsNotUpdated) {
773774
auto &cs = csr->getCS();
774775
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
775-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
776+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
776777
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
777778
uint8_t bbStart[64];
778779
batchBuffer.endCmdPtr = &bbStart[0];
@@ -791,7 +792,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
791792
mock->bindAvailable = true;
792793
auto &cs = csr->getCS();
793794
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
794-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
795+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
795796
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
796797
uint8_t bbStart[64];
797798
batchBuffer.endCmdPtr = &bbStart[0];
@@ -809,7 +810,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
809810
HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenEnabledDirectSubmissionOnBlitterWhenFlushThenFlushStampIsNotUpdated) {
810811
auto &cs = csr->getCS();
811812
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
812-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
813+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
813814
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
814815
uint8_t bbStart[64];
815816
batchBuffer.endCmdPtr = &bbStart[0];
@@ -830,7 +831,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenEnabledDire
830831
mock->bindAvailable = true;
831832
auto &cs = csr->getCS();
832833
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
833-
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
834+
EncodeNoop<FamilyType>::alignToCacheLine(cs);
834835
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
835836
uint8_t bbStart[64];
836837
batchBuffer.endCmdPtr = &bbStart[0];

0 commit comments

Comments
 (0)