mirror of
https://github.com/vosen/ZLUDA.git
synced 2025-08-04 15:19:49 +00:00
Add cvta
This commit is contained in:
parent
47f8314a5d
commit
588d66b236
3 changed files with 60 additions and 5 deletions
|
@ -16,6 +16,8 @@ pub enum PtxError {
|
||||||
source: ParseFloatError,
|
source: ParseFloatError,
|
||||||
},
|
},
|
||||||
#[error("")]
|
#[error("")]
|
||||||
|
Unsupported32Bit,
|
||||||
|
#[error("")]
|
||||||
SyntaxError,
|
SyntaxError,
|
||||||
#[error("")]
|
#[error("")]
|
||||||
NonF32Ftz,
|
NonF32Ftz,
|
||||||
|
|
|
@ -192,6 +192,14 @@ gen::generate_instruction_type!(
|
||||||
Ret {
|
Ret {
|
||||||
data: RetData
|
data: RetData
|
||||||
},
|
},
|
||||||
|
Cvta {
|
||||||
|
data: CvtaDetails,
|
||||||
|
type: { Type::Scalar(ScalarType::B64) },
|
||||||
|
arguments<T>: {
|
||||||
|
dst: T,
|
||||||
|
src: T,
|
||||||
|
}
|
||||||
|
},
|
||||||
Trap { }
|
Trap { }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -824,9 +832,9 @@ impl<T: Operand> CallArgs<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CvtDetails {
|
pub struct CvtDetails {
|
||||||
from: ScalarType,
|
pub from: ScalarType,
|
||||||
to: ScalarType,
|
pub to: ScalarType,
|
||||||
mode: CvtMode,
|
pub mode: CvtMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum CvtMode {
|
pub enum CvtMode {
|
||||||
|
@ -977,3 +985,13 @@ pub enum RightShiftKind {
|
||||||
Arithmetic,
|
Arithmetic,
|
||||||
Logical,
|
Logical,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct CvtaDetails {
|
||||||
|
pub state_space: StateSpace,
|
||||||
|
pub direction: CvtaDirection,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub enum CvtaDirection {
|
||||||
|
GenericToExplicit,
|
||||||
|
ExplicitToGeneric,
|
||||||
|
}
|
||||||
|
|
|
@ -814,6 +814,8 @@ pub enum PtxError {
|
||||||
#[error("")]
|
#[error("")]
|
||||||
NonF32Ftz,
|
NonF32Ftz,
|
||||||
#[error("")]
|
#[error("")]
|
||||||
|
Unsupported32Bit,
|
||||||
|
#[error("")]
|
||||||
WrongType,
|
WrongType,
|
||||||
#[error("")]
|
#[error("")]
|
||||||
UnknownFunction,
|
UnknownFunction,
|
||||||
|
@ -1666,11 +1668,44 @@ derive_parser!(
|
||||||
arguments: ShrArgs { dst: d, src1: a, src2: b }
|
arguments: ShrArgs { dst: d, src1: a, src2: b }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.type: ScalarType = { .b16, .b32, .b64,
|
.type: ScalarType = { .b16, .b32, .b64,
|
||||||
.u16, .u32, .u64,
|
.u16, .u32, .u64,
|
||||||
.s16, .s32, .s64 };
|
.s16, .s32, .s64 };
|
||||||
|
|
||||||
|
// https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-cvta
|
||||||
|
cvta.space.size p, a => {
|
||||||
|
if size != ScalarType::U64 {
|
||||||
|
state.errors.push(PtxError::Unsupported32Bit);
|
||||||
|
}
|
||||||
|
let data = ast::CvtaDetails {
|
||||||
|
state_space: space,
|
||||||
|
direction: ast::CvtaDirection::ExplicitToGeneric
|
||||||
|
};
|
||||||
|
let arguments = ast::CvtaArgs {
|
||||||
|
dst: p, src: a
|
||||||
|
};
|
||||||
|
ast::Instruction::Cvta {
|
||||||
|
data, arguments
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cvta.to.space.size p, a => {
|
||||||
|
if size != ScalarType::U64 {
|
||||||
|
state.errors.push(PtxError::Unsupported32Bit);
|
||||||
|
}
|
||||||
|
let data = ast::CvtaDetails {
|
||||||
|
state_space: space,
|
||||||
|
direction: ast::CvtaDirection::GenericToExplicit
|
||||||
|
};
|
||||||
|
let arguments = ast::CvtaArgs {
|
||||||
|
dst: p, src: a
|
||||||
|
};
|
||||||
|
ast::Instruction::Cvta {
|
||||||
|
data, arguments
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.space: StateSpace = { .const, .global, .local, .shared{::cta, ::cluster}, .param{::entry} };
|
||||||
|
.size: ScalarType = { .u32, .u64 };
|
||||||
|
|
||||||
// https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#control-flow-instructions-ret
|
// https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#control-flow-instructions-ret
|
||||||
ret{.uni} => {
|
ret{.uni} => {
|
||||||
Instruction::Ret { data: RetData { uniform: uni } }
|
Instruction::Ret { data: RetData { uniform: uni } }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue