minor update

This commit is contained in:
Blaise Tine 2024-05-01 08:06:45 -07:00
parent 06896f272c
commit 4737cdabbd
4 changed files with 12 additions and 11 deletions

View file

@ -85,6 +85,7 @@ static const char* op_string(const Instr &instr) {
auto func2 = instr.getFunc2();
auto func3 = instr.getFunc3();
auto func7 = instr.getFunc7();
auto rd = instr.getRDest();
auto rs2 = instr.getRSrc(1);
auto imm = instr.getImm();
@ -384,10 +385,10 @@ static const char* op_string(const Instr &instr) {
switch (func3) {
case 0: return "TMC";
case 1: return "WSPAWN";
case 2: return imm ? "SPLIT.N" : "SPLIT";
case 2: return rs2 ? "SPLIT.N" : "SPLIT";
case 3: return "JOIN";
case 4: return "BAR";
case 5: return imm ? "PRED.N" : "PRED";
case 5: return rd ? "PRED.N" : "PRED";
default:
std::abort();
}
@ -515,14 +516,14 @@ std::shared_ptr<Instr> Emulator::decode(uint32_t code) const {
instr->addSrcReg(rs2, RegType::Integer);
break;
case 5: // PRED
instr->setDestReg(rd, RegType::None);
instr->addSrcReg(rs1, RegType::Integer);
instr->addSrcReg(rs2, RegType::Integer);
instr->setImm(rd);
break;
case 2: // SPLIT
instr->setDestReg(rd, RegType::Integer);
instr->addSrcReg(rs1, RegType::Integer);
instr->setImm(rs2);
instr->addSrcReg(rs2, RegType::None);
break;
default:
std::abort();

View file

@ -1312,7 +1312,7 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
auto stack_size = warp.ipdom_stack.size();
ThreadMask then_tmask, else_tmask;
auto not_pred = immsrc & 0x1;
auto not_pred = rsrc2 & 0x1;
for (uint32_t t = 0; t < num_threads; ++t) {
auto cond = (warp.ireg_file.at(t).at(rsrc0) & 0x1) ^ not_pred;
then_tmask[t] = warp.tmask.test(t) && cond;
@ -1375,7 +1375,7 @@ void Emulator::execute(const Instr &instr, uint32_t wid, instr_trace_t *trace) {
trace->used_iregs.set(rsrc1);
trace->fetch_stall = true;
ThreadMask pred;
auto not_pred = immsrc & 0x1;
auto not_pred = rdest & 0x1;
for (uint32_t t = 0; t < num_threads; ++t) {
auto cond = (warp.ireg_file.at(t).at(rsrc0) & 0x1) ^ not_pred;
pred[t] = warp.tmask.test(t) && cond;

View file

@ -355,11 +355,11 @@ void kernel_bar(int task_id, kernel_arg_t* __UNIFORM__ arg) {
auto src0_ptr = (uint32_t*)arg->src0_addr;
auto dst_ptr = (uint32_t*)arg->dst_addr;
// update destination using the first threads in core
// update destination using the first thread in core
if (wid == 0 && tid == 0) {
int block_size = arg->num_tasks / num_cores;
int offset = cid * block_size;
for (int i = 0; i <= block_size; ++i) {
for (int i = 0; i < block_size; ++i) {
dst_ptr[i + offset] = src0_ptr[i + offset];
}
}
@ -386,7 +386,7 @@ void kernel_gbar(int task_id, kernel_arg_t* __UNIFORM__ arg) {
auto src0_ptr = (uint32_t*)arg->src0_addr;
auto dst_ptr = (uint32_t*)arg->dst_addr;
// update destination using the first threads in processor
// update destination using the first thread in processor
if (cid == 0 && wid == 0 && tid == 0) {
for (int i = 0, n = arg->num_tasks; i <= n; ++i) {
dst_ptr[i] = src0_ptr[i];

View file

@ -123,9 +123,9 @@ int main(int argc, char *argv[]) {
RT_CHECK(vx_mem_address(src0_buffer, &kernel_arg.src0_addr));
RT_CHECK(vx_mem_alloc(device, buf_size, VX_MEM_READ, &src1_buffer));
RT_CHECK(vx_mem_address(src1_buffer, &kernel_arg.src1_addr));
RT_CHECK(vx_mem_alloc(device, sizeof(kernel_arg_t), VX_MEM_READ, &args_buffer));
RT_CHECK(vx_mem_alloc(device, buf_size, VX_MEM_WRITE, &dst_buffer));
RT_CHECK(vx_mem_alloc(device, buf_size, VX_MEM_READ_WRITE, &dst_buffer));
RT_CHECK(vx_mem_address(dst_buffer, &kernel_arg.dst_addr));
RT_CHECK(vx_mem_alloc(device, sizeof(kernel_arg_t), VX_MEM_READ, &args_buffer));
std::cout << "dev_src0=0x" << std::hex << kernel_arg.src0_addr << std::dec << std::endl;
std::cout << "dev_src1=0x" << std::hex << kernel_arg.src1_addr << std::dec << std::endl;