Skip to content

Use of a parametric function in both a proc next function and function results in duplicate ConversionRecords #1308

@hongted

Description

@hongted

IR conversion of the following dslx (with a parametric function called both in another function and in the proc next function):

fn count<IMPL: bool>(x:u32) -> u32 {
  for(i, v): (u32, u32) in u32:0..u32:10 {
   v 
  } (x)
}

fn main() -> u32 {
  count<false>(u32:0)
}

proc Counter {
 in_ch: chan<u32> in;
  out_ch: chan<u32> out;
 
  init {
    u32:0 
  } 

  config(in_ch: chan<u32> in, out_ch: chan<u32> out) {
    (in_ch, out_ch)
  }

  next(tok: token, state: u32) {
    let (tok, in_data) = recv(tok, in_ch);
    let x = count<false>(in_data);
    let next_state = state + x;
    let tok = send(tok, out_ch, next_state);

     next_state
  }
}

Results in an error message

INTERNAL: XLS_RET_CHECK failure (third_party/xls/ir/verifier.cc:1862) !name_set->contains(function_base->name()) Function/proc/block with name ____test__count__0_counted_for_0_body is not unique within package test

Suspect that

static void RemoveFunctionDuplicates(std::vector<ConversionRecord>* ready) {
is not removing these duplicates due to them being partly parametric.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working or is incorrectdslxDSLX (domain specific language) implementation / front-end

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions