Repository navigation
Roland sipos/zero out optimization - #44
roland-sipos wants to merge 3 commits into
Conversation
|
Report of the performance testing comparing base to the changes made: Report of the TP quantities comparing base to the changes made: Overall, there is a significant performance improvement with the changes, and the TP quantities from both runs are consistent with one another. |
ShyamB97
left a comment
There was a problem hiding this comment.
Based on the testing I think the changes are ready and PR can be opened for merge.
|
Based on discussion in the readout WG meeting. two key points were raised by Alessandro:
Thus, it would be appropriate to defer this to next release. I would appreciate comments from @roland-sipos on this and discussion on slack with the relevant people would be good. |
|
Thanks for the test reports! |
|
Following discussion in the readout meeting two item came up related to this PR:
|
Description
Addresses issue #43
Changes Made
AVX Threshold Processor
File: AVXThresholdProcessor.cpp
Optimization: Replaced
_mm256_blendv_epi8(_mm256_setzero_si256(), signal, mask)with_mm256_and_si256(signal, mask).Latency/Throughput Improvement: Reduced a variable-blend instruction down to a single bitwise AND instruction, increasing throughput and port availability (releasing Port 5 constraints).
AVX Frugal Pedestal Subtract Processor
File: AVXFrugalPedestalSubtractProcessor.cpp
Optimizations: Replaced the two 3-instruction blocks generating
to_add = (is_gt ? 1 : 0) + (is_lt ? -1 : 0)(which materialized zero, 1, -1 and ran blendv) with_mm256_sub_epi16(is_lt, is_gt). Since comparison masks contain elements that are either 0 or 0xFFFF (which is signed -1), is_lt - is_gt mathematically computes the exact desired addition/subtraction.Replaced
_mm256_blendv_epi8(m_accum, _mm256_setzero_si256(), need_reset)with_mm256_andnot_si256(need_reset, m_accum).Latency/Throughput Improvement: Avoided 4 slow blendv instructions, 2 zero-vector initializations, and 4 constant-vector initializations. The operations now use single-cycle arithmetic subtraction and bitwise ANDNOT.
AVX Pipeline
File: AVXPipeline.cpp
Optimizations: Replaced
_mm256_blendv_epi8(_mm256_setzero_si256(), m_ones_register, active)with_mm256_and_si256(m_ones_register, active).Replaced 5 blendv calls masking fields in generate_tps with fast
_mm256_and_si256.Replaced 5 blendv calls resetting fields in generate_tps with fast
_mm256_andnot_si256.Latency/Throughput Improvement: Eliminated 11 slow variable-blend (blendv) intrinsics in the critical path of trigger primitive generation.
Standalone Benchmark and Verification App
A self-contained validation and performance benchmark app is located in /test/app/test_benchmark_tpg.cxx
You can build this benchmark application on any Linux system with GCC and AVX2 support without needing the DUNE-DAQ environment:
Compile
g++ -O3 -mavx2 test/apps/test_benchmark_tpg.cxx -o tpglibs_benchmark
Run
./tpglibs_benchmark
Type of change
Testing checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)dunedaq_integtest_bundle.sh)python -m pytest)pre-commit run --all-files)Comments here on the testing
Further checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))