Lib/vc4/Invoke.cpp
/**
 * Initialize uniforms to pass into running QPUs for vc4
 *
 * The number and types of parameters will not change for a given kernel.
 * The value of the parameters, however, can change, so this needs to be reset every time.
 *
 * All uniform values are the same for all QPUs, *except* the qpu id.
 *
 * ----------------------------------------------------------------------------
 * Notes
 * =====
 *
 * 1. Often (not always!), the final param is passed garbled when input as 
 *    a uniform to a kernel program executing on vc4 hardware.
 *    It appears to happen to direct Float/Int values.
 *    After spending days on this with paranoid debugging, I could not find the
 *    cause and gave up. Instead, I'll just pass a final dummy uniform value,
 *    which can be mangled to the heart's content of the hardware.
 */
Initialize uniforms to pass into running QPUs for vc4
The number and types of parameters will not change for a given kernel.
The value of the parameters, however, can change, so this needs to be reset every time.

All uniform values are the same for all QPUs, *except* the qpu id.

Notes

1. Often (not always!), the final param is passed garbled when input as
a uniform to a kernel program executing on vc4 hardware.
It appears to happen to direct Float/Int values.
After spending days on this with paranoid debugging, I could not find the
cause and gave up. Instead, I'll just pass a final dummy uniform value,
which can be mangled to the heart's content of the hardware.
Initialize uniforms to pass into running QPUs for vc4 The number and types of parameters will not change for a given kernel . The value of the parameters however can change so this needs to be reset every time . All uniform values are the same for all QPUs * except * the qpu id . Notes 1 . Often ( not always! ) the final param is passed garbled when input as a uniform to a kernel program executing on vc4 hardware . It appears to happen to direct Float / Int values . After spending days on this with paranoid debugging I could not find the cause and gave up . Instead I ' ll just pass a final dummy uniform value which can be mangled to the heart ' s content of the hardware .
void load_uniforms(Data &uniforms, IntList const &params, int numQPUs) {
  assert(0 < numQPUs && numQPUs <= Platform::max_qpus());
  if (!uniforms.allocated()) {
    uniforms.alloc(num_params(params)*Platform::max_qpus());
  } else {
    assert((int) uniforms.size() == num_params(params)*Platform::max_qpus());
  }
  int offset = 0;
  for (int i = 0; i < numQPUs; i++) {
    uniforms[offset++] = (uint32_t) i;              
    uniforms[offset++] = (uint32_t) numQPUs;        
    for (int j = 0; j < params.size(); j++) {
      uniforms[offset++] = params[j];
    }
    uniforms[offset++] = 0;                         
  }
  assert(offset == num_params(params)*numQPUs);
}
void load_uniforms ( Data & uniforms , IntList const & params , int numQPUs ) { assert ( 0 < numQPUs && numQPUs <= Platform :: max_qpus ( ) ) ; if ( ! uniforms . allocated ( ) ) { uniforms . alloc ( num_params ( params ) * Platform :: max_qpus ( ) ) ; } else { assert ( ( int ) uniforms . size ( ) == num_params ( params ) * Platform :: max_qpus ( ) ) ; } int offset = 0 ; for ( int i = 0 ; i < numQPUs ; i ++ ) { uniforms [ offset ++ ] = ( uint32_t ) i ; uniforms [ offset ++ ] = ( uint32_t ) numQPUs ; for ( int j = 0 ; j < params . size ( ) ; j ++ ) { uniforms [ offset ++ ] = params [ j ] ; } uniforms [ offset ++ ] = 0 ; } assert ( offset == num_params ( params ) * numQPUs ) ; }
Initialize uniforms to pass into running QPUs for vc4
 The number and types of parameters will not change for a given kernel.
Initialize uniforms to pass into running QPUs for vc4 The number and types of parameters will not change for a given kernel .
// Unique QPU ID // QPU count // Dummy final parameter, see Note 1.