i965/cs: Reserve local invocation id in payload regs
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
parent
62e011d593
commit
c7161a3c35
|
@ -457,6 +457,35 @@ const struct brw_tracked_state brw_cs_state = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We are building the local ID push constant data using the simplest possible
|
||||||
|
* method. We simply push the local IDs directly as they should appear in the
|
||||||
|
* registers for the uvec3 gl_LocalInvocationID variable.
|
||||||
|
*
|
||||||
|
* Therefore, for SIMD8, we use 3 full registers, and for SIMD16 we use 6
|
||||||
|
* registers worth of push constant space.
|
||||||
|
*
|
||||||
|
* FINISHME: There are a few easy optimizations to consider.
|
||||||
|
*
|
||||||
|
* 1. If gl_WorkGroupSize x, y or z is 1, we can just use zero, and there is
|
||||||
|
* no need for using push constant space for that dimension.
|
||||||
|
*
|
||||||
|
* 2. Since GL_MAX_COMPUTE_WORK_GROUP_SIZE is currently 1024 or less, we can
|
||||||
|
* easily use 16-bit words rather than 32-bit dwords in the push constant
|
||||||
|
* data.
|
||||||
|
*
|
||||||
|
* 3. If gl_WorkGroupSize x, y or z is small, then we can use bytes for
|
||||||
|
* conveying the data, and thereby reduce push constant usage.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
unsigned
|
||||||
|
brw_cs_prog_local_id_payload_dwords(const struct gl_program *prog,
|
||||||
|
unsigned dispatch_width)
|
||||||
|
{
|
||||||
|
return 3 * dispatch_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a region containing the push constants for the CS on gen7+.
|
* Creates a region containing the push constants for the CS on gen7+.
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,6 +42,11 @@ void
|
||||||
brw_upload_cs_prog(struct brw_context *brw);
|
brw_upload_cs_prog(struct brw_context *brw);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
brw_cs_prog_local_id_payload_dwords(const struct gl_program *prog,
|
||||||
|
unsigned dispatch_width);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "brw_eu.h"
|
#include "brw_eu.h"
|
||||||
#include "brw_wm.h"
|
#include "brw_wm.h"
|
||||||
#include "brw_fs.h"
|
#include "brw_fs.h"
|
||||||
|
#include "brw_cs.h"
|
||||||
#include "brw_cfg.h"
|
#include "brw_cfg.h"
|
||||||
#include "brw_dead_control_flow.h"
|
#include "brw_dead_control_flow.h"
|
||||||
#include "main/uniforms.h"
|
#include "main/uniforms.h"
|
||||||
|
@ -4731,6 +4732,15 @@ fs_visitor::setup_cs_payload()
|
||||||
assert(devinfo->gen >= 7);
|
assert(devinfo->gen >= 7);
|
||||||
|
|
||||||
payload.num_regs = 1;
|
payload.num_regs = 1;
|
||||||
|
|
||||||
|
if (prog->SystemValuesRead & SYSTEM_BIT_LOCAL_INVOCATION_ID) {
|
||||||
|
const unsigned local_id_dwords =
|
||||||
|
brw_cs_prog_local_id_payload_dwords(prog, dispatch_width);
|
||||||
|
assert((local_id_dwords & 0x7) == 0);
|
||||||
|
const unsigned local_id_regs = local_id_dwords / 8;
|
||||||
|
payload.local_invocation_id_reg = payload.num_regs;
|
||||||
|
payload.num_regs += local_id_regs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -364,6 +364,7 @@ public:
|
||||||
uint8_t sample_pos_reg;
|
uint8_t sample_pos_reg;
|
||||||
uint8_t sample_mask_in_reg;
|
uint8_t sample_mask_in_reg;
|
||||||
uint8_t barycentric_coord_reg[BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT];
|
uint8_t barycentric_coord_reg[BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT];
|
||||||
|
uint8_t local_invocation_id_reg;
|
||||||
|
|
||||||
/** The number of thread payload registers the hardware will supply. */
|
/** The number of thread payload registers the hardware will supply. */
|
||||||
uint8_t num_regs;
|
uint8_t num_regs;
|
||||||
|
|
Loading…
Reference in New Issue