Skip to content

Commit

Permalink
Working NVVM/CUDA support on Tegra K1:
Browse files Browse the repository at this point in the history
- use platform independent variables of fixed size in codegen/runtime
  • Loading branch information
richardmembarth committed Feb 12, 2015
1 parent bfec3b7 commit 86f46ea
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 124 deletions.
7 changes: 4 additions & 3 deletions runtime/common/thorin_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
#define _THORIN_RUNTIME_H

#ifdef __cplusplus
#include <cstdint>
#include <cstdlib>
#else
#include <stdint.h>
#include <stdlib.h>
#endif

extern "C" {
// runtime functions, used externally from C++ interface
void thorin_init();
void *thorin_malloc(size_t size);
void *thorin_malloc(uint32_t size);
void thorin_free(void *ptr);
void thorin_print_total_timing();
}

#ifdef __cplusplus
template<typename T>
static T* thorin_new(unsigned n)
{
static T* thorin_new(uint32_t n) {
return (T*)thorin_malloc(n*sizeof(T));
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion runtime/cpu/cpu_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// helper functions
void thorin_init() { }
void *thorin_malloc(size_t size) {
void *thorin_malloc(uint32_t size) {
void *mem;
posix_memalign(&mem, 64, size);
std::cerr << " * malloc(" << size << ") -> " << mem << std::endl;
Expand Down
Loading

0 comments on commit 86f46ea

Please sign in to comment.