Skip to content
New issue

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

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

Closed
hongted opened this issue Feb 15, 2024 · 2 comments
Assignees
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end

Comments

@hongted
Copy link
Collaborator

hongted commented Feb 15, 2024

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.

@hongted hongted added bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end labels Feb 15, 2024
@hongted hongted changed the title Use of a for in a parametric function in proc next function results in duplicate ConversionRecords Use of a parametric function in both a proc next function and function results in duplicate ConversionRecords Feb 15, 2024
copybara-service bot pushed a commit that referenced this issue Feb 15, 2024
from ir_converter's ConversionRecords list.

#1308

PiperOrigin-RevId: 607156855
@cdleary
Copy link
Collaborator

cdleary commented Feb 21, 2024

@hongted I think maybe you forgot to put "fixes" in that change description which would have automatically closed this -- it's fixed now, right?

@hongted
Copy link
Collaborator Author

hongted commented Feb 22, 2024

Yes, should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or is incorrect dslx DSLX (domain specific language) implementation / front-end
Projects
None yet
Development

No branches or pull requests

2 participants