Skip to content

frontend: type inference for return type is "incorrect" when constants are in the program #1520

Closed
@asraa

Description

@asraa

Reproducer:

## Simple Example
@compile(debug=True)  # defaults to scheme="bgv", OpenFHE backend, and debug=False
def func(x: Secret[I16], y: Secret[I16]):
  sum = x + y + 255
  diff = x - y
  mul = x * y
  expression = sum * diff + mul
  deadcode = expression * mul
  return expression

Numba will automatically make 255 an i64, which means the result type will be inferred to be an i64. Right now this example fails to compile due to a ValueError complaining about the type of the constant differing from the i16s that are otherwise annotated in the program.

The numba TypeInferer seems to have a lot of parameters. I'll investigate whether there's something I can tell to it to make that estimate more inline.

@AlexanderViand-Intel

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions