rev: ed75a3e440d5bfe660a22175fd08458fce62598e tukan/testing/test_compute_process.sc -rw-r--r-- 1.4 KiB View raw Log this file
ed75a3e440d5 — Leonard Ritter * more work on type schema a month ago
                                                                                
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env scopes

import ..lib.tukan.use
using import tukan.gpucall
using import glsl
using import glm
using import testing

#
    design goals for the programming language model of tukan:
    * pure functional
    * sandboxed
    * no recursions, no loops
    * bulk data processing through map/filter/reduce abstractions (transducers)
    * transparent & cohesive code generation for CPU/GPU
    * structural type system
    * no JIT, GC free
    * fused if/select
    * immutable data structures
    * first order closures
    * multiple return values
    * pseudoquoting
    * polymorphic at compile time
    * modules are databases
    * deduplication through content-addressing

    its closest cousin is probably http://futhark-lang.org



    types:

    bool
    i32
    f32
    tuple T ...
    vector T size
    function <tuple-type> <- <tuple-type>





shared tmp : vec3

@@ gpufn
fn testfunc (x y)
    tmp =
        vec3
            x + y
            x - y
            x * y
    unpack (deref tmp)

print (testfunc 2.0 3.0)
print (testfunc 0.1 0.2)

test ((gpucall bitcount 5) == (bitcount 5))
test ((gpucall findlsb 32768) == (findlsb 32768))
test ((gpucall bitreverse 0b10010110) == (bitreverse 0b10010110))
test (all? ((gpucall findmsb (vectorof i32 1 3 5 9)) == (vectorof i32 0 1 2 3)))
test ((gpucall findmsb 6) == (findmsb 6))
test ((gpucall findmsb 0) == (findmsb 0))
test ((gpucall findlsb 0) == (findlsb 0))

;