diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-05-28 14:23:35 -0400 |
---|---|---|
committer | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-05-30 18:14:55 -0400 |
commit | 27a51ff9b420909334898785cf194b5998776e88 (patch) | |
tree | 9830d69848db25474f504f7730cd207eac7cc748 | |
parent | ae708795309d7e6e590a0232bdac93188a96d78f (diff) |
nv50/ir: record number of threads in a compute shader
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 files changed, 10 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp index 35cd7217c2..2caebe87ef 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp @@ -1178,6 +1178,7 @@ nv50_ir_init_prog_info(struct nv50_ir_prog_info *info) info->prop.gp.instanceCount = 1; info->prop.gp.maxVertices = 1; } + info->prop.cp.numThreads = 1; info->io.pointSize = 0xff; info->io.instanceId = 0xff; info->io.vertexId = 0xff; diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h index 1f7de51e3f..b611519ade 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h @@ -153,6 +153,7 @@ struct nv50_ir_prog_info uint32_t inputOffset; /* base address for user args */ uint32_t sharedOffset; /* reserved space in s[] */ uint32_t gridInfoBase; /* base address for NTID,NCTAID */ + uint32_t numThreads; /* max number of threads */ } cp; } prop; diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp index 1ebcd25e96..cd98f70098 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp @@ -1002,6 +1002,7 @@ bool Source::scanSource() } info->io.viewportId = -1; + info->prop.cp.numThreads = 1; info->immd.data = (uint32_t *)MALLOC(scan.immediate_count * 16); info->immd.type = (ubyte *)MALLOC(scan.immediate_count * sizeof(ubyte)); @@ -1105,7 +1106,7 @@ void Source::scanProperty(const struct tgsi_full_property *prop) case TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH: case TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT: case TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH: - // we don't care + info->prop.cp.numThreads *= prop->u[0].Data; break; case TGSI_PROPERTY_NUM_CLIPDIST_ENABLED: info->io.clipDistances = prop->u[0].Data; diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.h index 674bdc6964..6bf1a5cff2 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.h @@ -172,7 +172,9 @@ public: // The address chosen is supplied to the relocation routine. virtual void getBuiltinCode(const uint32_t **code, uint32_t *size) const = 0; - virtual void parseDriverInfo(const struct nv50_ir_prog_info *info) { } + virtual void parseDriverInfo(const struct nv50_ir_prog_info *info) { + threads = info->prop.cp.numThreads; + } virtual bool runLegalizePass(Program *, CGStage stage) const = 0; @@ -248,6 +250,7 @@ public: protected: uint32_t chipset; + uint32_t threads; DataFile nativeFileMap[DATA_FILE_COUNT]; diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp index 2af1715d1d..b37ea730d0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp @@ -592,6 +592,8 @@ TargetNV50::parseDriverInfo(const struct nv50_ir_prog_info *info) wposMask = 0x8; sysvalLocation[SV_POSITION] = 0; } + + Target::parseDriverInfo(info); } } // namespace nv50_ir |