diff options
author | Andrzej Janik <[email protected]> | 2020-01-08 23:53:35 +0100 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2020-01-08 23:53:35 +0100 |
commit | 14116ce5404bafb464974f0b0b32431ad9830583 (patch) | |
tree | 7574561b719802da6cbfd9d316cbfb6576d82245 /notcuda | |
parent | 30e8286d5394818539d49b7580bb288a01857d5a (diff) | |
download | ZLUDA-14116ce5404bafb464974f0b0b32431ad9830583.tar.gz ZLUDA-14116ce5404bafb464974f0b0b32431ad9830583.zip |
Split project into three
Diffstat (limited to 'notcuda')
-rw-r--r-- | notcuda/.gitignore | 2 | ||||
-rw-r--r-- | notcuda/Cargo.toml | 8 | ||||
-rw-r--r-- | notcuda/src/cu.rs | 85 | ||||
-rw-r--r-- | notcuda/src/lib.rs | 23 |
4 files changed, 118 insertions, 0 deletions
diff --git a/notcuda/.gitignore b/notcuda/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/notcuda/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/notcuda/Cargo.toml b/notcuda/Cargo.toml new file mode 100644 index 0000000..99dd974 --- /dev/null +++ b/notcuda/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "notcuda" +version = "0.0.0" +authors = ["Andrzej Janik <[email protected]>"] +edition = "2018" + +[lib] +crate-type = ["cdylib"]
\ No newline at end of file diff --git a/notcuda/src/cu.rs b/notcuda/src/cu.rs new file mode 100644 index 0000000..56ba61c --- /dev/null +++ b/notcuda/src/cu.rs @@ -0,0 +1,85 @@ +#[repr(C)]
+#[allow(non_camel_case_types)]
+pub enum Result {
+ SUCCESS = 0,
+ ERROR_INVALID_VALUE = 1,
+ ERROR_OUT_OF_MEMORY = 2,
+ ERROR_NOT_INITIALIZED = 3,
+ ERROR_DEINITIALIZED = 4,
+ ERROR_PROFILER_DISABLED = 5,
+ ERROR_PROFILER_NOT_INITIALIZED = 6,
+ ERROR_PROFILER_ALREADY_STARTED = 7,
+ ERROR_PROFILER_ALREADY_STOPPED = 8,
+ ERROR_NO_DEVICE = 100,
+ ERROR_INVALID_DEVICE = 101,
+ ERROR_INVALID_IMAGE = 200,
+ ERROR_INVALID_CONTEXT = 201,
+ ERROR_CONTEXT_ALREADY_CURRENT = 202,
+ ERROR_MAP_FAILED = 205,
+ ERROR_UNMAP_FAILED = 206,
+ ERROR_ARRAY_IS_MAPPED = 207,
+ ERROR_ALREADY_MAPPED = 208,
+ ERROR_NO_BINARY_FOR_GPU = 209,
+ ERROR_ALREADY_ACQUIRED = 210,
+ ERROR_NOT_MAPPED = 211,
+ ERROR_NOT_MAPPED_AS_ARRAY = 212,
+ ERROR_NOT_MAPPED_AS_POINTER = 213,
+ ERROR_ECC_UNCORRECTABLE = 214,
+ ERROR_UNSUPPORTED_LIMIT = 215,
+ ERROR_CONTEXT_ALREADY_IN_USE = 216,
+ ERROR_PEER_ACCESS_UNSUPPORTED = 217,
+ ERROR_INVALID_PTX = 218,
+ ERROR_INVALID_GRAPHICS_CONTEXT = 219,
+ ERROR_NVLINK_UNCORRECTABLE = 220,
+ ERROR_JIT_COMPILER_NOT_FOUND = 221,
+ ERROR_INVALID_SOURCE = 300,
+ ERROR_FILE_NOT_FOUND = 301,
+ ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
+ ERROR_SHARED_OBJECT_INIT_FAILED = 303,
+ ERROR_OPERATING_SYSTEM = 304,
+ ERROR_INVALID_HANDLE = 400,
+ ERROR_ILLEGAL_STATE = 401,
+ ERROR_NOT_FOUND = 500,
+ ERROR_NOT_READY = 600,
+ ERROR_ILLEGAL_ADDRESS = 700,
+ ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
+ ERROR_LAUNCH_TIMEOUT = 702,
+ ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
+ ERROR_PEER_ACCESS_ALREADY_ENABLED = 704,
+ ERROR_PEER_ACCESS_NOT_ENABLED = 705,
+ ERROR_PRIMARY_CONTEXT_ACTIVE = 708,
+ ERROR_CONTEXT_IS_DESTROYED = 709,
+ ERROR_ASSERT = 710,
+ ERROR_TOO_MANY_PEERS = 711,
+ ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
+ ERROR_HOST_MEMORY_NOT_REGISTERED = 713,
+ ERROR_HARDWARE_STACK_ERROR = 714,
+ ERROR_ILLEGAL_INSTRUCTION = 715,
+ ERROR_MISALIGNED_ADDRESS = 716,
+ ERROR_INVALID_ADDRESS_SPACE = 717,
+ ERROR_INVALID_PC = 718,
+ ERROR_LAUNCH_FAILED = 719,
+ ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720,
+ ERROR_NOT_PERMITTED = 800,
+ ERROR_NOT_SUPPORTED = 801,
+ ERROR_SYSTEM_NOT_READY = 802,
+ ERROR_SYSTEM_DRIVER_MISMATCH = 803,
+ ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804,
+ ERROR_STREAM_CAPTURE_UNSUPPORTED = 900,
+ ERROR_STREAM_CAPTURE_INVALIDATED = 901,
+ ERROR_STREAM_CAPTURE_MERGE = 902,
+ ERROR_STREAM_CAPTURE_UNMATCHED = 903,
+ ERROR_STREAM_CAPTURE_UNJOINED = 904,
+ ERROR_STREAM_CAPTURE_ISOLATION = 905,
+ ERROR_STREAM_CAPTURE_IMPLICIT = 906,
+ ERROR_CAPTURED_EVENT = 907,
+ ERROR_STREAM_CAPTURE_WRONG_THREAD = 908,
+ ERROR_TIMEOUT = 909,
+ ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910,
+ ERROR_UNKNOWN = 999,
+}
+
+#[repr(C)]
+pub struct Uuid {
+ x: [std::os::raw::c_char; 16]
+}
\ No newline at end of file diff --git a/notcuda/src/lib.rs b/notcuda/src/lib.rs new file mode 100644 index 0000000..fee62d0 --- /dev/null +++ b/notcuda/src/lib.rs @@ -0,0 +1,23 @@ +mod cu; + +#[no_mangle] +pub extern "stdcall" fn cuDriverGetVersion(version: &mut std::os::raw::c_int) -> cu::Result { + *version = 0; + return cu::Result::SUCCESS; +} + +#[no_mangle] +pub extern "stdcall" fn cuInit(_: *const std::os::raw::c_uint) -> cu::Result { + return cu::Result::SUCCESS; +} + +#[no_mangle] +pub extern "stdcall" fn cuGetExportTable(_: *const *const std::os::raw::c_void, _: cu::Uuid) -> cu::Result { + return cu::Result::ERROR_NOT_SUPPORTED; +} + +#[no_mangle] +pub extern "stdcall" fn cuDeviceGetCount(count: &mut std::os::raw::c_int) -> cu::Result { + *count = 1; + return cu::Result::SUCCESS; +} |