How do I get WMB.dat and WGS.dat to enable sparse compression options for direct convolution simulation testing?

I read Sparse Compression option and CDMA-related RTL code and couldn’t find WGS and WMB data generated by sparse compression algorithm. Where is this code implemented and written into Memory? I want to implement a direct convolution hardware test and synthesis with sparse compression enabled, how can i do ? Please help me, thanks very much!


Could you check the below repo:


I spent some time reading sw’s source code,found the following related functions and does modify:

  1. change canCompressWeights(false) to true,path:
    change m_canCompressWeights(false)to true,path:
  2. change isCompressWeightsCapable(false) to true,path:
    change m_isCompressWeightsCapable(false) to true,path:
    and change m_targetConfigParams.m_isCompressWeightsCapable = false to true in isLargeConfig() of sw\umd\core\src\compiler\TargetConfig.cpp
  3. change the follow in sw\umd\core\src\compiler\engine-ast\ConvolutionOp.cpp and sw\umd\core\src\compiler\engine-ast\FullyConnectedOp.cpp
*conv_op.weightFormat()     = conv_op.weightFormat_Uncompressed(); → conv_op.weightFormat_Compressed()
 protoConvOpDesc->set_weight_format(nvdla_prototest_interface::WeightFormat::UNCOMPRESSED); → nvdla_prototest_interface::WeightFormat::COMPRESSED

In hw, the following operations are performed:

  1. enable weight compression in hw/spec/defs/nv_large.spec
  1. change reset and default values in hw/spec/manal/NVDLA_CMDA.rdl and hw/spec/manal/NVDLA_CSC.rdl
reg {
        name = "D_WEIGHT_FORMAT";
            UNCOMPRESSED = 1'd0;
            COMPRESSED = 1'd1;
        field {
            encode          = D_WEIGHT_FORMAT_WEIGHT_FORMAT_enum;
            sw              = rw;
            hw              = r;
            spec_access     = rw;
            reset           = 0x1;
            reset_mask      = 0x1;
            spec_sw_default = 0x1;
            sw_default_mask = 0x1;
        } WEIGHT_FORMAT[0:0];

Then refer to ‘this link’, recompile and generate the CMOD of hw, VP platform and Complier of SW, and then use the network model of lenet5 to perform inference tasks on VP platform, and interrupt at runtime and report errors:

Fatal: NV_NVDLA_cdma.cpp: 2087:If weight uncompressed, all cdma2sc_wt should have been sent

In file: ../cmod/cdma/NV_NVDLA_cdma.cpp:2087
In process: nvdla.nvdla_core.nvdla_core.cdma.WeightReadResponseSequenceThread @ 65600 ms
Aborted (core dumped)

if (!cdma_wt_dma_arbiter_override_enable || (cdma_weight_format_ == NVDLA_CDMA_D_WEIGHT_FORMAT_0_WEIGHT_FORMAT_UNCOMPRESSED))
            FAIL(("If weight uncompressed, all cdma2sc_wt should have been sent,%d\n",cdma_weight_format_));

Is it appropriate for me to modify HW and SW source code like this? What should I do to enable full weight compression to support VP inference task completion or to generate weight compression data that HW needs?
Please help me, thanks very much!

in sw\umd\core\src\compiler\Surface.cpp

NvU32 WeightDesc::wgs(const TensorSurfaceDesc* tsd)
    gLogError << __func__ << "Not Yet Supported" << endl;
    return 0;

NvU32 WeightDesc::wmb(const TensorSurfaceDesc* tsd)
    gLogError << __func__ << "Not Yet Supported" << endl;
    return 0;

WGS and WMB functions related to weight compression have stopped updating ?


Yes, the repo has not been updated for a while.
So it might not work with the latest software release.