Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autogen/external/SPIRV-Headers
Submodule SPIRV-Headers updated 100 files
2 changes: 1 addition & 1 deletion autogen/src/sr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ pub fn gen_sr_code_from_instruction_grammar(
};

let ops = quote! {
use crate::sr::{module::Jump, storage::Token, Type};
use crate::sr::{module::Jump, storage::Token, Constant, Type};

#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Branch {
Expand Down
2 changes: 2 additions & 0 deletions autogen/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ pub enum Class {
DeviceSideEnqueue,
#[serde(rename = "Non-Uniform")]
NonUniform,
Tensor,
Graph,
Reserved,
#[serde(rename = "@exclude")]
Exclude,
Expand Down
2 changes: 1 addition & 1 deletion rspirv/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rspirv"
version = "0.12.0+sdk-1.4.309.0"
version = "0.12.0+sdk-1.4.321.0"
authors = ["Lei Zhang <[email protected]>"]
edition = "2018"

Expand Down
1 change: 1 addition & 0 deletions rspirv/binary/assemble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ impl Assemble for dr::Operand {
Self::CooperativeMatrixReduce(v) => result.push(v.bits()),
Self::TensorClampMode(v) => result.push(v as u32),
Self::TensorAddressingOperands(v) => result.push(v.bits()),
Self::TensorOperands(v) => result.push(v.bits()),
Self::InitializationModeQualifier(v) => result.push(v as u32),
Self::LoadCacheControl(v) => result.push(v as u32),
Self::StoreCacheControl(v) => result.push(v as u32),
Expand Down
11 changes: 11 additions & 0 deletions rspirv/binary/autogen_decode_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,15 @@ impl Decoder<'_> {
Err(Error::StreamExpected(self.offset))
}
}
#[doc = "Decodes and returns the next SPIR-V word as\na SPIR-V TensorOperands value."]
pub fn tensor_operands(&mut self) -> Result<spirv::TensorOperands> {
if let Ok(word) = self.word() {
spirv::TensorOperands::from_bits(word).ok_or(Error::TensorOperandsUnknown(
self.offset - WORD_NUM_BYTES,
word,
))
} else {
Err(Error::StreamExpected(self.offset))
}
}
}
24 changes: 24 additions & 0 deletions rspirv/binary/autogen_disas_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,3 +481,27 @@ impl Disassemble for spirv::MatrixMultiplyAccumulateOperands {
bits.join("|")
}
}
impl Disassemble for spirv::TensorOperands {
fn disassemble(&self) -> String {
if self.is_empty() {
return "None".to_string();
}
let mut bits = vec![];
if self.contains(spirv::TensorOperands::NONTEMPORAL_ARM) {
bits.push("NontemporalARM")
}
if self.contains(spirv::TensorOperands::OUT_OF_BOUNDS_VALUE_ARM) {
bits.push("OutOfBoundsValueARM")
}
if self.contains(spirv::TensorOperands::MAKE_ELEMENT_AVAILABLE_ARM) {
bits.push("MakeElementAvailableARM")
}
if self.contains(spirv::TensorOperands::MAKE_ELEMENT_VISIBLE_ARM) {
bits.push("MakeElementVisibleARM")
}
if self.contains(spirv::TensorOperands::NON_PRIVATE_ELEMENT_ARM) {
bits.push("NonPrivateElementARM")
}
bits.join("|")
}
}
6 changes: 6 additions & 0 deletions rspirv/binary/autogen_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub enum Error {
FPEncodingUnknown(usize, spirv::Word),
CooperativeVectorMatrixLayoutUnknown(usize, spirv::Word),
ComponentTypeUnknown(usize, spirv::Word),
TensorOperandsUnknown(usize, spirv::Word),
#[doc = r"Failed to decode a string."]
#[doc = r""]
#[doc = r"For structured error handling, the second element could be"]
Expand Down Expand Up @@ -359,6 +360,11 @@ impl fmt::Display for Error {
"unknown value {} for operand kind ComponentType at index {}",
word, index
),
Error::TensorOperandsUnknown(index, word) => write!(
f,
"unknown value {} for operand kind TensorOperands at index {}",
word, index
),
Error::DecodeStringFailed(index, ref e) => {
write!(f, "cannot decode string at index {}: {}", index, e)
}
Expand Down
28 changes: 28 additions & 0 deletions rspirv/binary/autogen_parse_operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ impl Parser<'_, '_> {
ops.append(&mut self.parse_tensor_addressing_operands_arguments(val)?);
ops
}
GOpKind::TensorOperands => {
let val = self.decoder.tensor_operands()?;
let mut ops = vec![dr::Operand::TensorOperands(val)];
ops.append(&mut self.parse_tensor_operands_arguments(val)?);
ops
}
GOpKind::IdResultType => panic!(),
GOpKind::IdResult => panic!(),
GOpKind::LiteralContextDependentNumber => panic!(),
Expand Down Expand Up @@ -380,6 +386,11 @@ impl Parser<'_, '_> {
spirv::ExecutionMode::RoundingModeRTZ => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::ExecutionMode::TileShadingRateQCOM => vec![
dr::Operand::LiteralBit32(self.decoder.bit32()?),
dr::Operand::LiteralBit32(self.decoder.bit32()?),
dr::Operand::LiteralBit32(self.decoder.bit32()?),
],
spirv::ExecutionMode::IsApiEntryAMDX => vec![dr::Operand::IdRef(self.decoder.id()?)],
spirv::ExecutionMode::MaxNodeRecursionAMDX => {
vec![dr::Operand::IdRef(self.decoder.id()?)]
Expand Down Expand Up @@ -649,6 +660,7 @@ impl Parser<'_, '_> {
spirv::Decoration::ImplementInRegisterMapINTEL => {
vec![dr::Operand::LiteralBit32(self.decoder.bit32()?)]
}
spirv::Decoration::ConditionalINTEL => vec![dr::Operand::IdRef(self.decoder.id()?)],
spirv::Decoration::CacheControlLoadINTEL => vec![
dr::Operand::LiteralBit32(self.decoder.bit32()?),
dr::Operand::LoadCacheControl(self.decoder.load_cache_control()?),
Expand All @@ -673,4 +685,20 @@ impl Parser<'_, '_> {
}
Ok(params)
}
fn parse_tensor_operands_arguments(
&mut self,
tensor_operands: spirv::TensorOperands,
) -> Result<Vec<dr::Operand>> {
let mut params = vec![];
if tensor_operands.contains(spirv::TensorOperands::OUT_OF_BOUNDS_VALUE_ARM) {
params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
}
if tensor_operands.contains(spirv::TensorOperands::MAKE_ELEMENT_AVAILABLE_ARM) {
params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
}
if tensor_operands.contains(spirv::TensorOperands::MAKE_ELEMENT_VISIBLE_ARM) {
params.append(&mut vec![dr::Operand::IdRef(self.decoder.id()?)]);
}
Ok(params)
}
}
Loading
Loading