nak: Rename TLS to SLM

Shader Local Memory is what NVIDIA calls it in the shader header docs as
well as the command stream headers.  Better to be consistent even if it
gets my Intel brain confused.  (Intel uses SLM for shared memory.)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197>
This commit is contained in:
Faith Ekstrand 2023-11-14 12:41:44 -06:00 committed by Marge Bot
parent a946071546
commit 4e6e814f5e
7 changed files with 20 additions and 20 deletions

View file

@ -79,8 +79,8 @@ struct nak_shader_info {
/** Number of barriers used */
uint8_t num_barriers;
/** Size of thread-local storage */
uint32_t tls_size;
/** Size of shader local (scratch) memory */
uint32_t slm_size;
union {
struct {

View file

@ -281,7 +281,7 @@ pub extern "C" fn nak_compile_shader(
stage: nir.info.stage(),
num_gprs: s.info.num_gprs,
num_barriers: s.info.num_barriers,
tls_size: s.info.tls_size,
slm_size: s.info.slm_size,
__bindgen_anon_1: match &s.info.stage {
ShaderStageInfo::Compute(cs_info) => {
nak_shader_info__bindgen_ty_1 {
@ -387,7 +387,7 @@ pub extern "C" fn nak_compile_shader(
};
eprintln!("Stage: {}", stage_name);
eprintln!("Num GPRs: {}", info.num_gprs);
eprintln!("TLS size: {}", info.tls_size);
eprintln!("SLM size: {}", info.slm_size);
if info.stage != MESA_SHADER_COMPUTE {
eprint_hex("Header", &info.hdr);

View file

@ -20,7 +20,7 @@ fn init_info_from_nir(nir: &nir_shader, sm: u8) -> ShaderInfo {
sm: sm,
num_gprs: 0,
num_barriers: 0,
tls_size: nir.scratch_size,
slm_size: nir.scratch_size,
uses_global_mem: false,
writes_global_mem: false,
// TODO: handle this.

View file

@ -5022,7 +5022,7 @@ pub struct ShaderInfo {
pub sm: u8,
pub num_gprs: u8,
pub num_barriers: u8,
pub tls_size: u32,
pub slm_size: u32,
pub uses_global_mem: bool,
pub writes_global_mem: bool,
pub uses_fp64: bool,

View file

@ -6,15 +6,15 @@ use crate::nak_ir::*;
use std::cmp::max;
struct LowerCopySwap {
tls_start: u32,
tls_size: u32,
slm_start: u32,
slm_size: u32,
}
impl LowerCopySwap {
fn new(tls_size: u32) -> Self {
fn new(slm_size: u32) -> Self {
Self {
tls_start: tls_size,
tls_size: tls_size,
slm_start: slm_size,
slm_size: slm_size,
}
}
@ -50,8 +50,8 @@ impl LowerCopySwap {
space: MemSpace::Local,
order: MemOrder::Strong(MemScope::CTA),
};
let addr = self.tls_start + src_reg.base_idx() * 4;
self.tls_size = max(self.tls_size, addr + 4);
let addr = self.slm_start + src_reg.base_idx() * 4;
self.slm_size = max(self.slm_size, addr + 4);
b.push_op(OpLd {
dst: copy.dst,
addr: Src::new_zero(),
@ -105,8 +105,8 @@ impl LowerCopySwap {
space: MemSpace::Local,
order: MemOrder::Strong(MemScope::CTA),
};
let addr = self.tls_start + dst_reg.base_idx() * 4;
self.tls_size = max(self.tls_size, addr + 4);
let addr = self.slm_start + dst_reg.base_idx() * 4;
self.slm_size = max(self.slm_size, addr + 4);
b.push_op(OpSt {
addr: Src::new_zero(),
data: copy.src,
@ -176,8 +176,8 @@ impl LowerCopySwap {
impl Shader {
pub fn lower_copy_swap(&mut self) {
let mut pass = LowerCopySwap::new(self.info.tls_size);
let mut pass = LowerCopySwap::new(self.info.slm_size);
pass.run(self);
self.info.tls_size = pass.tls_size;
self.info.slm_size = pass.slm_size;
}
}

View file

@ -421,8 +421,8 @@ pub fn encode_header(
sph.set_does_global_store(shader_info.writes_global_mem);
sph.set_does_fp64(shader_info.uses_fp64);
let tls_size = shader_info.tls_size.next_multiple_of(16);
sph.set_shader_local_memory_size(tls_size.into());
let slm_size = shader_info.slm_size.next_multiple_of(16);
sph.set_shader_local_memory_size(slm_size.into());
match &shader_info.io {
ShaderIoInfo::Vtg(io) => {

View file

@ -407,7 +407,7 @@ nvk_compile_nir_with_nak(struct nvk_physical_device *pdev,
else
shader->num_gprs = MAX2(4, bin->info.num_gprs);
shader->num_barriers = bin->info.num_barriers;
shader->slm_size = bin->info.tls_size;
shader->slm_size = bin->info.slm_size;
switch (nir->info.stage) {
case MESA_SHADER_COMPUTE: