From: Ilia Mirkin Date: Sat, 28 May 2016 18:23:35 +0000 (-0400) Subject: nv50/ir: record number of threads in a compute shader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=27a51ff9b420909334898785cf194b5998776e88;p=mesa.git nv50/ir: record number of threads in a compute shader Signed-off-by: Ilia Mirkin Reviewed-by: Samuel Pitoiset --- diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp index 35cd7217c2c..2caebe87efe 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 1f7de51e3f6..b611519ade3 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 1ebcd25e96a..cd98f700982 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 674bdc6964e..6bf1a5cff23 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 2af1715d1d1..b37ea730d0e 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