We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug It seems that one can't currently index array w/ values deduced from proc parameters.
To Reproduce
proc matmul<ROWS: u32, COLS: u32> { activations_in: chan<F32>[ROWS] in; results_out: chan<F32>[COLS] out; west_inputs: chan<F32>[COLS + u32:1][ROWS] in; east_outputs: chan<F32>[COLS + u32:1][ROWS] out; north_inputs: chan<F32>[COLS][ROWS + u32:1] in; south_outputs: chan<F32>[COLS][ROWS + u32:1] out; config(activations_in: chan<F32>[ROWS] in, results_out: chan<F32>[COLS] out) { let (east_outputs, west_inputs) = chan<F32>[COLS + u32:1][ROWS]("east_west"); let (south_outputs, north_inputs) = chan<F32>[COLS][ROWS + u32:1]("north_south"); unroll_for! (row, _): (u32, ()) in u32:0..ROWS { unroll_for! (col, _): (u32, ()) in u32:0..COLS { let weight = F32 { sign: false, bexp: if col == row { u8:128 } else { u8:0 }, fraction: u23:0, }; spawn node( west_inputs[row][col], north_inputs[row][col], east_outputs[row][col + u32:1], south_outputs[row + u32:1][col], weight); }(()); }(()); (activations_in, results_out, west_inputs, east_outputs, north_inputs, south_outputs) } init { () } next(state: ()) { let activations_col = u32:0; unroll_for! (row, _): (u32, ()) in u32:0..ROWS { let (tok, activation) = recv(join(), activations_in[row]); send(tok, east_outputs[row][activations_col], activation); }(()); let zeroes_row = u32:0; unroll_for! (col, _): (u32, ()) in u32:0..COLS { send(join(), south_outputs[zeroes_row][col], float32::zero(false)); }(()); let drops_col = COLS + u32:1; unroll_for! (row, _): (u32, ()) in u32:0..ROWS { recv(join(), west_inputs[row][drops_col]); }(()); let results_row = ROWS + u32:1; unroll_for! (col, _): (u32, ()) in u32:0..COLS { let (tok, result) = recv(join(), north_inputs[results_row][col]); send(tok, results_out[col], result); }(()); } }
will produce the following error:
F1128 00:52:50.016040 4046 channel_scope.cc:417] Check failed: !subarray->flattened_names_in_order().empty() *** Check failure stack trace: *** absl::log_internal::LogMessage::SendToLog() absl::log_internal::LogMessage::Flush() absl::log_internal::LogMessageFatal::~LogMessageFatal() xls::dslx::ChannelScope::GetOrDefineSubarray() xls::dslx::ChannelScope::GetChannelArrayElement() xls::dslx::ChannelScope::EvaluateIndex() xls::dslx::ChannelScope::GetChannelOrArrayForArrayIndex() xls::dslx::FunctionConverter::HandleIndex() xls::dslx::FunctionConverterVisitor::Visit() xls::dslx::FunctionConverter::HandleBuiltinRecv() xls::dslx::FunctionConverter::HandleInvocation() xls::dslx::FunctionConverterVisitor::Visit() std::__u::__variant_detail::__visitation::__base::__dispatcher<>::__dispatch<>() xls::dslx::FunctionConverter::HandleStatement() xls::dslx::FunctionConverterVisitor::Visit() xls::dslx::FunctionConverter::HandleStatementBlock() xls::dslx::FunctionConverterVisitor::Visit() std::__u::__variant_detail::__visitation::__base::__dispatcher<>::__dispatch<>() xls::dslx::FunctionConverter::HandleStatement() xls::dslx::FunctionConverterVisitor::Visit() xls::dslx::FunctionConverter::HandleStatementBlock() xls::dslx::FunctionConverterVisitor::HandleUnrollFor() xls::dslx::FunctionConverterVisitor::Visit() std::__u::__variant_detail::__visitation::__base::__dispatcher<>::__dispatch<>() xls::dslx::FunctionConverter::HandleStatement() xls::dslx::FunctionConverterVisitor::Visit() xls::dslx::FunctionConverter::HandleStatementBlock() xls::dslx::FunctionConverterVisitor::Visit() xls::dslx::FunctionConverter::HandleProcNextFunction() xls::dslx::(anonymous namespace)::ConvertCallGraph() xls::dslx::ConvertModuleIntoPackage() xls::dslx::ConvertModuleToPackage() xls::dslx::AbstractTestRunner::ParseAndTest() main __libc_start_main _start
Expected behavior chan array can be indexes from arbitrary computed values.
The text was updated successfully, but these errors were encountered:
Adding a dummy outer unroll_for to capture the constant seems to workaround the issue:
unroll_for
unroll_for! (row, _): (u32, ()) in ROWS..ROWS + u32:1 { unroll_for! (col, _): (u32, ()) in u32:0..COLS { let (tok, result) = recv(join(), north_inputs[row][col]); send(tok, results_out[col], result); }(()); }(());
Sorry, something went wrong.
No branches or pull requests
Describe the bug
It seems that one can't currently index array w/ values deduced from proc parameters.
To Reproduce
will produce the following error:
Expected behavior
chan array can be indexes from arbitrary computed values.
The text was updated successfully, but these errors were encountered: