Skip to content

[Fusilli-plugin] Add scalar value support #140

@MaheshRavishankar

Description

@MaheshRavishankar

When a tensor is constructed with set_value(0.5f)
(pass-by-value immediate), Fusilli emits it as a function argument (%in1_4:
!torch.vtensor<[1],f32>) instead of inlining it as a constant in the
generated MLIR. At execution time, Fusilli expects a device buffer for uid 4
in the variant pack, but since the tensor was marked pass-by-value, the
caller doesn't provide one.

The relevant part of the generated MLIR (line 3):
func.func @main(%out0_5_: !torch.tensor<[64,32],f32>,
%a_1: !torch.vtensor<[64,128],f32>,
%b_2: !torch.vtensor<[128,32],f32>,
%in1_4: !torch.vtensor<[1],f32>) // <-- alpha=0.5, should be
a constant

The scalar alpha (uid 4) should be emitted as an inline constant, e.g.:
%alpha = torch.constant.float 0.5
instead of being a function argument that requires a device buffer.

Error:
Device buffer with the uid: 4 not found in the provided device buffers.

Attached are logs from hipDNN and the MLIR that is generated for the example I was working on .

alpha_only_log.txt

alpha_only_input.mlir.txt

Metadata

Metadata

Assignees

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