Skip to content

[dslx] Allow struct parametrics to be types other than u32 #978

@cdleary

Description

@cdleary

Right now we evaluate all parametric expressions given to a struct as u32s, but that's technically too strict a limitation -- although we only allow u32s to appear in e.g. array dimensions when building a type, you could imagine a use case like the following:

  struct Point<N: u5, N_U32: u32 = {N as u32}> {                                                                                  
    x: uN[N_U32],                                                                                                                 
  }                                                                                                                               
                                                                                                                                  
  fn f(p: Point<u5:3>) -> uN[3] {                                                                                                 
    p.y                                                                                                                           
  } 

Note that the value given as N is not used in any type definition, just as a value that we do some computation from.

Note that I'm going to land a change that overly restricts them to all be u32s at first to fix #727, then we can loosen from there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dslxDSLX (domain specific language) implementation / front-endenhancementNew feature or request

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions