blob: 0785f3ed09aeb450c5b58f16c917067e28165e60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
use super::ptx;
use super::TranslateError;
mod spirv_run;
fn parse_and_assert(s: &str) {
let mut errors = Vec::new();
ptx::ModuleParser::new().parse(&mut errors, s).unwrap();
assert!(errors.len() == 0);
}
fn compile_and_assert(s: &str) -> Result<(), TranslateError> {
let mut errors = Vec::new();
let ast = ptx::ModuleParser::new().parse(&mut errors, s).unwrap();
crate::to_spirv_module(ast)?;
Ok(())
}
#[test]
fn empty() {
parse_and_assert(".version 6.5 .target sm_30, debug");
}
#[test]
fn operands_ptx() {
let vector_add = include_str!("operands.ptx");
parse_and_assert(vector_add);
}
#[test]
#[allow(non_snake_case)]
fn vectorAdd_kernel64_ptx() -> Result<(), TranslateError> {
let vector_add = include_str!("vectorAdd_kernel64.ptx");
compile_and_assert(vector_add)
}
#[test]
#[allow(non_snake_case)]
fn _Z9vectorAddPKfS0_Pfi_ptx() -> Result<(), TranslateError> {
let vector_add = include_str!("_Z9vectorAddPKfS0_Pfi.ptx");
compile_and_assert(vector_add)
}
#[test]
#[allow(non_snake_case)]
fn vectorAdd_11_ptx() -> Result<(), TranslateError> {
let vector_add = include_str!("vectorAdd_11.ptx");
compile_and_assert(vector_add)
}
|