Repository navigation
Allow selection of verbosity level for vtrace_fmt! messages - #3932
joannabrozek wants to merge 25 commits into
Conversation
max_trace_verbosity flag vtrace_fmt! messages
983deff to
5bd314f
Compare
5bd314f to
656fb31
Compare
| if (node->verbosity().has_value()) { | ||
| XLS_ASSIGN_OR_RETURN(InterpValue verbosity_val, | ||
| type_info_->GetConstExpr(*node->verbosity())); | ||
| absl::StatusOr<int64_t> verbosity_as_int64 = |
There was a problem hiding this comment.
We should be able to assume here that if the node has a verbosity value then the constexpr is a valid int64, and just do XLS_ASSIGN_OR_RETURN. Perhaps add a check for this in validate_concrete_type.cc if it's not really checked in type inference currently.
There was a problem hiding this comment.
I used XLS_ASSIGN_OR_RETURN as mentioned.
| } | ||
|
|
||
| TEST_F(BytecodeInterpreterTest, VtraceFmtBitsValueDefaultFormat) { | ||
| constexpr std::string_view kProgram = R"( |
There was a problem hiding this comment.
Let's verify, either here or in a different test, that regular trace_fmt! works as expected with a max verbosity set.
There was a problem hiding this comment.
Added in the same file.
| absl::Span<const absl::flat_hash_map<std::string, Value>> inputs, | ||
| const std::optional<verilog::ResetProto>& reset, int64_t seed) const { | ||
| const std::optional<verilog::ResetProto>& reset, int64_t seed, | ||
| const std::optional<int64_t> max_trace_verbosity = 0) const { |
There was a problem hiding this comment.
I wonder if we should make this non-optional wherever the distinction between 0 and nullopt is irrelevant throughout the PR. It's unusual to have an optional default to 0, and probably a sign that passing in nullopt is irrelevant in such places.
There was a problem hiding this comment.
I've migrated to non-optional throughout the PR.
656fb31 to
641815b
Compare
|
@richmckeever, thank you for the review. I've rebased the code and added the suggested changes. Let me know if there's still something missing. |
641815b to
6c51a0e
Compare
|
I've rebased changes onto the latest main and resolved conflicts. |
There was a problem hiding this comment.
fyi, we get this failure internally:
libcxx/include/__memory/unique_ptr.h: error: allocating an object of abstract class type 'xls::(anonymous namespace)::JitContinuationAdapter'
756 | return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...));
| ^
fifo_fuzz_test.cc: note: in instantiation of function template specialization 'std::make_unique<xls::(anonymous namespace)::JitContinuationAdapter, std::unique_ptr<xls::BlockJitContinuation>, xls::BlockJit *&, 0>' requested here
256 | return std::make_unique<JitContinuationAdapter>(std::move(blk_cont), jit);
| ^
block_evaluator.h: note: unimplemented pure virtual method 'SetMaxTraceVerbosity' in 'JitContinuationAdapter'
444 | virtual void SetMaxTraceVerbosity(int64_t value) = 0;
There was a problem hiding this comment.
I see pure virtual SetMaxTraceVerbosity from BlockContinuation is not implemented in a newly added JitContinuationAdapter class deriving from BlockContinuation. For reference, you can see how we implemented it in BlockContinuationJitWrapper as a lazy init for max_trace_verbosity of BlockJitContinuation or noop in StatelessBlockContinuation.
There was a problem hiding this comment.
@proppy I see JitContinuationAdapter class is only available internally. Can this be fixed on Google's side?
|
@magancarz @joannabrozek I can try to fix the Can you please try rebasing? |
| std::unique_ptr<TypeManager> type_manager = std::make_unique<TypeManager>(); | ||
|
|
||
| RuntimeObserver* observer = nullptr; | ||
| int64_t max_trace_verbosity_ = 0; |
There was a problem hiding this comment.
Remove underscore (because it's a struct).
6c51a0e to
239b582
Compare
|
@mikex-oss I rebased this PR |
|
@rw1nkler sorry can you rebase again? |
239b582 to
5caef4a
Compare
|
Looks like we need another rebase. |
5caef4a to
89d3261
Compare
|
Rebased, requires #5259 to build correctly without the cache in nightly CI |
| rewrite ftp.gnu.org/(?:pub/)?gnu/(.*) https://ftpmirror.gnu.org/$1 | ||
| rewrite ftp.gnu.org/(?:pub/)?gnu/(.*) https://ftp.gnu.org/gnu/$1 | ||
|
|
||
| # TODO: Remove once BCR fixes sv-lang@10.0.1-20260316-f04e8156 integrity. |
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
89d3261 to
c732f0b
Compare
|
PTAL @grebe @richmckeever |
Add support for excluding
vtrace_fmt!messages according tomax_trace_verbosityflag for:DSLX interpreter:
max_trace_verbosityflag with the default value set to 100 (seexls/dslx/interpreter_main.cc)verbosity_to theTraceDataclass to be able to pass the verbosity ofvtrace_fmt!()messages (seexls/dslx/bytecode/bytecode.h)max_trace_verbosityflag propagation usingBytecodeInterpreterOptionsto the bytecode interpreter, where the vtrace messages are filtered (seexls/dslx/bytecode/bytecode_interpreter.cc)vtrace_fmt!()(seexls/dslx/bytecode/bytecode_interpreter_test.cc)IR interpreter:
emit_positionsflag, which is enabled by default, as it was previously hardcoded as enabled as well - seexls/dslx/ir_convert/ir_converter_main.cc)trace_fmt!()andvtrace_fmt!()(see thexls/dslx/run_routines/run_routines.ccfile)SourceInfoinsideTraceso that the displayed logs include information about which file they came from and their location (row and column) - seexls/dslx/ir_convert/function_converter.ccxls/dslx/interpreter_test.pyDslxInterpreterEventspointer and populating it (seexls/dslx/run_routines/run_routines.ccandxls/dslx/run_routines/ir_test_runner.cc)vtrace_fmt!()messages filtering (seexls/interpreter/ir_interpreter.cc)xls/interpreter/ir_evaluator_test_base.cc)JIT and AOT:
max_trace_verbosity_to theEvaluatorOptionsandJitEvaluatorOptionsclasses to be able to propagate themax_trace_verbosityflag (seexls/interpreter/evaluator_options.handxls/jit/jit_evaluator_options.h)max_trace_verbosityflag and passed it usingJitEvaluatorOptions(seexls/jit/aot_compiler_main.cc)max_trace_verbosityflag propagation usingEvaluatorOptionsfor function and block wrappers (seexls/jit/jit_function_wrapper_cc.tmpl,xls/jit/function_base_jit_wrapper.handxls/jit/block_base_jit_wrapper.h)vtrace_fmt!()messages filtering (seexls/jit/jit_callbacks.cc)xls/examples/vtrace_fmt.x,xls/examples/vtrace_fmt_block_jit_test.cc,xls/examples/vtrace_fmt_jit_test.cc,xls/examples/vtrace_fmt_proc_jit_test.cc)xls/jit/function_jit.cc) and a test (seexls/jit/function_jit_test.cc)xls/jit/block_jit.cc) and updated the test (seexls/interpreter/block_evaluator_test_base.cc)xls/jit/proc_jit.cc) and a test (seexls/interpreter/proc_evaluator_test_base.cc)xls/jit/function_jit_aot_test.cc)eval_ir_main tool:
max_trace_verbosityflag and passed it usingJitEvaluatorOptions(seexls/tools/eval_ir_main.cc)xls/tools/eval_ir_main_test.py)eval_proc_main tool:
max_trace_verbosityflag and passed it usingBlockEvaluator(seexls/tools/eval_proc_main.cc)xls/tools/eval_proc_main_test.py)codegen_main tool:
max_trace_verbosityflag propagation (addressing the issue: Mismatch betweenmax_trace_verbosityandvtrace_fmt!codegen output #3080) - seexls/tools/codegen.ccandxls/tools/codegen_flags.ccxls/tools/codegen_main_test.py)