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;
99 std::shared_ptr<DeviceFDEntry> fdp;
100 fdp = std::make_shared<DeviceFDEntry>(
this,
filename);
101 int tgt_fd =
p->fds->allocFD(fdp);
167 int string_table_size = 0;
170 string_table_size += k->
name().size() + 1;
173 BufferArg buf(buf_addr, string_table_size);
178 const char *
n = k->
name().c_str();
181 while ((*bufp++ = *n++));
184 assert(bufp - (
char *)buf.
bufferPtr() == string_table_size);
225 bufp[buf_idx] = k->
insts()->at(
j);
236 BufferArg buf(buf_addr,
sizeof(uint32_t));
244 BufferArg buf(buf_addr,
sizeof(uint32_t));
251 BufferArg buf(buf_addr,
sizeof(uint32_t));
258 fatal(
"ClDriver: bad ioctl %d\n", req);
268 uint32_t code_offs = code_ptr -
hsaCode;
280 ClDriverParams::create()
This file defines buffer classes used to handle pointer arguments in emulated syscalls.
int ioctl(ThreadContext *tc, unsigned req)
Abstract method, invoked when the user program calls ioctl() on the file descriptor returned by a pre...
std::vector< TheGpuISA::RawMachInst > * insts()
#define fatal(...)
This implements a cprintf based fatal() function.
uint32_t getStaticContextSize() const
Returns the size of the static hardware context of a wavefront.
uint32_t string_table_size
static const int HSA_GET_STRINGS
virtual void generateHsaKernelInfo(HsaKernelInfo *hsaKernelInfo) const =0
virtual PortProxy & getVirtProxy()=0
virtual Process * getProcessPtr()=0
void handshake(GpuDispatcher *_dispatcher)
void setFuncargsSize(int funcargs_size)
static const int HSA_GET_KINFO
const std::string & name() const
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
static HsaObject * createHsaObject(const std::string &fname)
virtual RegVal getSyscallArg(ThreadContext *tc, int &i)=0
void * bufferPtr()
Return a pointer to the internal simulator-space buffer.
const char * codeOffToKernelName(uint64_t code_ptr)
uint32_t private_mem_size
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
int open(ThreadContext *tc, int mode, int flags)
Abstract method, invoked when the user program calls open() on the device driver. ...
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
bool copyOut(PortProxy &memproxy)
copy data out of simulator space (write to target memory)
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.
virtual HsaCode * getKernel(const std::string &name) const =0
std::vector< HsaKernelInfo > kernelInfo