Skip to content

Commit bf4d86c

Browse files
committed
build fixes
1 parent 5126bb3 commit bf4d86c

6 files changed

Lines changed: 26 additions & 29 deletions

File tree

hw/rtl/core/VX_ibuffer.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ module VX_ibuffer import VX_gpu_pkg::*; #(
6565
decode_if.data.rs1,
6666
decode_if.data.rs2,
6767
decode_if.data.rs3,
68-
1'b0, // fu_lock
69-
1'b0 // fu_unlock
68+
1'b1, // fu_lock
69+
1'b1 // fu_unlock
7070
}),
7171
.ready_in (ibuf_ready_in[w]),
7272
.valid_out(ibuffer_tmp_if.valid),

hw/rtl/core/VX_scoreboard.sv

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,8 @@ module VX_scoreboard import VX_gpu_pkg::*; #(
204204
wire [PER_ISSUE_WARPS-1:0] fu_lock_block;
205205
for (genvar w = 0; w < PER_ISSUE_WARPS; ++w) begin : g_fu_lock_block
206206
wire [EX_BITS-1:0] w_ex = staging_if[w].data.ex_type;
207-
// Block warps when FU is locked. Owner warp's uops have fu_lock=1
208-
// (set by the uop expander) and bypass the block.
209-
assign fu_lock_block[w] = fu_locked[w_ex] && ~staging_if[w].data.fu_lock;
207+
// Block warps when FU is locked. fu_lock=1 means acquire request.
208+
assign fu_lock_block[w] = fu_locked[w_ex] && staging_if[w].data.fu_lock;
210209
end
211210

212211
for (genvar w = 0; w < PER_ISSUE_WARPS; ++w) begin : g_arb_data_in
@@ -276,9 +275,7 @@ module VX_scoreboard import VX_gpu_pkg::*; #(
276275
assign arb_ready = ready_out_w;
277276

278277
// FU lock: prevent warp interleaving during multi-uop sequences.
279-
// fu_lock=1 on all uops of a locked sequence (set by uop expander).
280-
// fu_unlock=1 on the last uop releases the lock.
281-
// Non-owner warps have fu_lock=0 and are blocked while fu_locked is set.
278+
// 10=acquire (first uop), 00=middle, 01=release (last uop), 11=default.
282279

283280
wire issue_fire = valid_out_w && ready_out_w;
284281

@@ -299,10 +296,10 @@ module VX_scoreboard import VX_gpu_pkg::*; #(
299296
if (reset) begin
300297
fu_locked <= '0;
301298
end else if (issue_fire) begin
302-
if (issue_fu_unlock) begin
303-
fu_locked[issue_ex] <= 1'b0;
304-
end else if (issue_fu_lock) begin
299+
if (issue_fu_lock && ~issue_fu_unlock) begin
305300
fu_locked[issue_ex] <= 1'b1;
301+
end else if (~issue_fu_lock && issue_fu_unlock) begin
302+
fu_locked[issue_ex] <= 1'b0;
306303
end
307304
end
308305
end

hw/rtl/tcu/VX_tcu_uops.sv

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,8 @@ module VX_tcu_uops import VX_tcu_pkg::*, VX_gpu_pkg::*; (
377377
ibuf_r.used_rs[2] = wmma_is_first_k;
378378
`endif
379379
end
380-
// Lock the FU during the entire macro-op sequence.
381-
// fu_lock=1 on all uops identifies this as part of a locked sequence.
382-
// fu_unlock=1 on the last uop releases the lock after issue.
383-
ibuf_r.fu_lock = 1'b1;
380+
// FU lock: 10=acquire (first), 00=middle, 01=release (last).
381+
ibuf_r.fu_lock = (uop_idx == UOP_CTR_W'(0));
384382
ibuf_r.fu_unlock = (uop_idx == (uop_count - UOP_CTR_W'(1)));
385383
end
386384

sim/simx/core.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,10 +386,10 @@ void Core::issue() {
386386
} else {
387387
uop_trace->log_once(false);
388388
// FU lock: block warps whose target FU is locked by another warp.
389-
// Owner warp's uops have fu_lock=1 (set by uop expander) and bypass.
389+
// fu_lock=1 means acquire request; blocked when FU already locked.
390390
auto fu = (int)uop_trace->fu_type;
391391
bool uop_fu_lock = uop_trace->instr_ptr->get_fu_lock();
392-
if (fu_locked_.test(fu) && !uop_fu_lock) {
392+
if (fu_locked_.test(fu) && uop_fu_lock) {
393393
continue; // blocked by FU lock
394394
}
395395
ready_set.set(w); // mark instruction as ready
@@ -427,13 +427,15 @@ void Core::issue() {
427427
// update scoreboard
428428
scoreboard_.reserve(uop_trace);
429429
}
430-
// Update FU lock state
430+
// Update FU lock state: 10=acquire, 01=release
431431
{
432-
auto fu = (int)uop_trace->fu_type;
433-
if (uop_trace->instr_ptr->get_fu_unlock()) {
434-
fu_locked_.reset(fu);
435-
} else if (uop_trace->instr_ptr->get_fu_lock()) {
436-
fu_locked_.set(fu);
432+
auto fui = (int)uop_trace->fu_type;
433+
bool fl = uop_trace->instr_ptr->get_fu_lock();
434+
bool ful = uop_trace->instr_ptr->get_fu_unlock();
435+
if (fl && !ful) {
436+
fu_locked_.set(fui);
437+
} else if (!fl && ful) {
438+
fu_locked_.reset(fui);
437439
}
438440
}
439441
// Advance sequencer; pop ibuffer only when all micro-ops issued

sim/simx/decode.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ static op_string_t op_string(const Instr &instr) {
393393
#endif
394394
#ifdef EXT_V_ENABLE
395395
,[&](VsetType vset_type)-> op_string_t {
396-
auto vset_args = std::get<IntrVset_args>(instrArgs);
396+
auto vset_args = std::get<IntrVsetArgs>(instrArgs);
397397
switch (vset_type) {
398398
case VsetType::VSETVLI: return {"VSETVLI", vset_args.to_string(vset_type)};
399399
case VsetType::VSETIVLI: return {"VSETIVLI", vset_args.to_string(vset_type)};
@@ -935,17 +935,17 @@ Instr::Ptr Emulator::decode(uint32_t code, uint32_t /*wid*/, uint64_t uuid) {
935935
instr->set_dest_reg(rd, RegType::Integer);
936936
if ((code >> 30) == 0b10) { // vsetvl
937937
instr->set_op_type(VsetType::VSETVL);
938-
instr->set_args(IntrVset_args{0, 0});
938+
instr->set_args(IntrVsetArgs{0, 0});
939939
instr->set_src_reg(0, rs1, RegType::Integer);
940940
instr->set_src_reg(1, rs2, RegType::Integer);
941941
} else {
942942
auto zimm = (code >> shift_vzimm) & mask_vzimm;
943943
if ((code >> 30) == 0b11) { // vsetivli
944944
instr->set_op_type(VsetType::VSETIVLI);
945-
instr->set_args(IntrVset_args{zimm, rs1});
945+
instr->set_args(IntrVsetArgs{zimm, rs1});
946946
} else { // vsetvli
947947
instr->set_op_type(VsetType::VSETVLI);
948-
instr->set_args(IntrVset_args{zimm, 0});
948+
instr->set_args(IntrVsetArgs{zimm, 0});
949949
instr->set_src_reg(0, rs1, RegType::Integer);
950950
}
951951
}

sim/simx/tensor_unit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,8 +1305,8 @@ Instr::Ptr TcuUopGen::get(const Instr& macro_instr, uint32_t uop_index) {
13051305
#endif
13061306

13071307
// fu_lock/fu_unlock: prevent warp interleaving during TCU K-accumulation.
1308-
// fu_lock=1 on all uops identifies the owner; fu_unlock=1 on last releases.
1309-
uop_instr->set_fu_lock(true);
1308+
// 10=acquire (first), 00=middle, 01=release (last), 11=default (non-sequenced).
1309+
uop_instr->set_fu_lock(uop_index == 0);
13101310
uop_instr->set_fu_unlock(uop_index == total - 1);
13111311

13121312
return uop_instr;

0 commit comments

Comments
 (0)