46 #include "params/ClDriver.hh"
53 for (
const auto &codeFile : p->codefile)
65 int kern_funcargs_size =
kernels.back()->funcarg_size;
83 name_offs += k->
name().size() + 1;
98 std::shared_ptr<DeviceFDEntry> fdp;
99 fdp = std::make_shared<DeviceFDEntry>(
this,
filename);
100 int tgt_fd = p->
fds->allocFD(fdp);
165 int string_table_size = 0;
168 string_table_size += k->
name().size() + 1;
171 BufferArg buf(buf_addr, string_table_size);
176 const char *
n = k->
name().c_str();
179 while ((*bufp++ = *n++));
182 assert(bufp - (
char *)buf.
bufferPtr() == string_table_size);
223 bufp[buf_idx] = k->
insts()->at(
j);
234 BufferArg buf(buf_addr,
sizeof(uint32_t));
242 BufferArg buf(buf_addr,
sizeof(uint32_t));
249 BufferArg buf(buf_addr,
sizeof(uint32_t));
256 fatal(
"ClDriver: bad ioctl %d\n", req);
266 uint32_t code_offs = code_ptr -
hsaCode;
278 ClDriverParams::create()
This file defines buffer classes used to handle pointer arguments in emulated syscalls.
std::vector< TheGpuISA::RawMachInst > * insts()
int open(Process *p, ThreadContext *tc, int mode, int flags)
Abstract method, invoked when the user program calls open() on the device driver. ...
uint32_t string_table_size
static const int HSA_GET_STRINGS
virtual void generateHsaKernelInfo(HsaKernelInfo *hsaKernelInfo) const =0
uint32_t getStaticContextSize() const
Returns the size of the static hardware context of a wavefront.
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i)=0
void handshake(GpuDispatcher *_dispatcher)
void setFuncargsSize(int funcargs_size)
static const int HSA_GET_KINFO
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
ThreadContext is the external interface to all thread state for anything outside of the CPU...
static const int HSA_GET_HW_STATIC_CONTEXT_SIZE
bool copyOut(SETranslatingPortProxy &memproxy)
copy data out of simulator space (write to target memory)
static HsaObject * createHsaObject(const std::string &fname)
const std::string & name() const
void * bufferPtr()
Return a pointer to the internal simulator-space buffer.
const char * codeOffToKernelName(uint64_t code_ptr)
uint32_t private_mem_size
virtual SETranslatingPortProxy & getMemProxy()=0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static const int HSA_GET_CODE
static const int HSA_GET_READONLY_DATA
std::vector< const std::string * > codeFiles
std::vector< HsaCode * > kernels
static const int HSA_GET_SIZES
const std::string & filename
filename for opening this driver (under /dev)
static const int HSA_GET_CU_CNT
static const int HSA_GET_VSZ
virtual int numKernels() const =0
GpuDispatcher * dispatcher
ClDriver(ClDriverParams *p)
BufferArg represents an untyped buffer in target user space that is passed by reference to an (emulat...
EmulatedDriver is an abstract base class for fake SE-mode device drivers.
int ioctl(Process *p, ThreadContext *tc, unsigned req)
Abstract method, invoked when the user program calls ioctl() on the file descriptor returned by a pre...
virtual HsaCode * getKernel(const std::string &name) const =0
std::vector< HsaKernelInfo > kernelInfo
std::shared_ptr< FDArray > fds