tasks for 0.2.0
Opened this issue · 3 comments
ariasanovsky commented
features
-
spin!
-
DevSpindle/HostSpindle
->DevSlice/HostSlice
or better name - define
spindle::Result<T>
- move this to a separate Github Issue
- put "implement
init::init
for tensor fusion" into a new Github Issue - put "implement
map::map
for tensor fusion" into a new Github Issue - put "configure device ordinals into typestate" in a new Github Issue
- put "configure sizes/dims typestate" in a new Github Issue
ergonomics
-
cargo doc
cross-platform, on crates.io, etc - safety docs
- docs for spindle structs
-
spindle clean
binary for easier artifact management
correctness
- resolve the into/try_into safety stuff
- prohibit
__
and maybe_
in map names - correctness for
RawConvert
- ? pub on all
use __foo::__Foo
traits
refactor
- define
Dev*
token structs -
impl Parse
andToTokens
as appropriate - refactor
basic_range
as an initializer (e.g.,#[spindle::init](#foo)
- define
DevInit*
-
impl Parse
andimpl ToTokens
as needed - add
DevInit
map to database - get from database
- return required tokens
- init kernel
- device item fn
- device method
- trait def'n
- trait impl
- define
- refactor
init::init
- fn tokens
- trait tokens
- add to db and reparse
- refactor
MapFn
withDev*
token structs- parse
- tokens
- add to db
- get from db
- ?more tokens
- refactor
spin::spin
to useitem_fn
table- ?tag
ItemFn
s by map type, e.g.,init
, kernel fusion map, or intermediate - look for maps and inits and emit the impls
- ?tag
- use
CARGO_TARGET_DIR
orCARGO_OUTPUT
more easily w/ db method - ?! refactor db to glob all maps into one table
- e.g., no
in_out
tables, justuuid
: unique identificationident
: no two maps tagged with the same identcontent
: equal toself.to_token_stream().to_strirng()
- offloads the type management into the macro crate
- prevents a
map
and aninit
from having the same name more easily - allows intermediate fns to be easily sent to the tagged crates
- easier to scale for composite returns and args later!
- define
AsDbItemFn
- define
get_or_insert
-
impl TryFrom<DbItemFn>
forDevItemFn
- e.g., no
deprecations
- remove dead code from
spindle_macros
[ ] this includesbasic_range
(RIP)- misc struct modules
- ?union db insertions
-
TokenResult
& pointless custom errors -
RangeSpindle
& friends -
file_strings.rs
- downgrade db iters to
Vec
s - remove/refactor worthless tests
sanitation
- better compiler error semaphore
[ ] enhancecargo clean
to also cleantarget/spindle/
- it already did lol
ariasanovsky commented
How do we want to handle
#[spindle::map(#foo)]
#[spindle::init(#foo)]
fn square_over_two(x: u64) -> f32 {
((x * x) / 2) as f32
}
spin!(#foo, U = u64 | f32);
We want to be able to
// initialize a `DevSlice` with `square_over_two` as a method on ranges
let init_nums: DevSlice<U, f32> = (0..).square_over_two(1_000_000)?; /*
// overwrite existing buffers
let new_slice: DevSlice<U, Uninit> = DevSlice::new(1_000_000)?;
let reused_slice /* : DevSlice<U, f32> */ = ((0..), new_slice).square_over_two(1_000_000)?; // **
// in-place map
let host_ints: Vec<u64> = (0..1_000_000).collect();
let claimed_ints: DevSlice<U, /* u64 */ _> = host_ints.try_into()?;
let mapped_ints /* : DevSlice<U, f32> */ = claimed_ints.square_over_two()?; // ***
with init_nums
, reused_slice
, mapped_ints
all having the same values and length
ariasanovsky commented
Example of using a static library (a
file) file in a compiled cu
project:
nvcc -o cuda_program main.cu path/to/lib.a -L . -lcuda -lcudart_static -arch=sm_60
with
// cu_main.cu
#include <cstdio>
extern "C" float adder(float, float, float);
int main(void)
{
float result = adder(1.f, 2.f, 3.f);
printf("%f\n", result);
return 0;
}
ariasanovsky commented
src/lib.rs
// src/lib.rs
#![no_std]
#[panic_handler]fn panic(_:&::core::panic::PanicInfo)->!{loop{}}
#[no_mangle]
pub extern "C" fn adder(a: f32, b: f32, c: f32) -> f32 {
a + 2.0 * b + 3.0 * c
}
Cargo.toml
[lib]
crate-type = [ "staticlib" ] # to generate a `lib<package_name>.a`
# i.e. an archive of `.o` files
[package]
name = "foo"
version = "0.1.0"
edition = "2018"
[dependencies] # you may depend on libc if you so wish:
# libc = { version = "*", default-features = false }
[profile.dev]
panic = "abort"
overflow-checks = false
[profile.release]
panic = "abort"
overflow-checks = false