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>
This commit is contained in:
Ilia Mirkin 2016-05-28 14:23:35 -04:00
parent ae70879530
commit 27a51ff9b4
5 changed files with 10 additions and 2 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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];

View file

@ -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