Skip to content

Instantly share code, notes, and snippets.

View pashu123's full-sized avatar
๐Ÿ˜‡
Working from home

Prashant Kumar pashu123

๐Ÿ˜‡
Working from home
View GitHub Profile
This file has been truncated, but you can view the full file.
#map = affine_map<(d0) -> (d0)>
#map1 = affine_map<(d0) -> ()>
#map2 = affine_map<() -> ()>
#map3 = affine_map<(d0, d1) -> ()>
#map4 = affine_map<(d0, d1) -> (d0, d1)>
#map5 = affine_map<(d0, d1) -> (d0, 0)>
#map6 = affine_map<(d0, d1) -> (0, d1)>
#map7 = affine_map<(d0, d1) -> (d1, d0)>
#map8 = affine_map<(d0, d1) -> (d1)>
#map9 = affine_map<(d0, d1, d2, d3) -> ()>
func.func @forward(%arg0: !torch.vtensor<[2,4,96,96],f32>, %arg1: !torch.vtensor<[2],si64>, %arg2: !torch.vtensor<[2,77,1024],f32>) -> !torch.vtensor<[2,4,96,96],f16> {
%int160 = torch.constant.int 160
%0 = torch.vtensor.literal(dense<1.250000e-01> : tensor<f64>) : !torch.vtensor<[],f64>
%1 = torch.vtensor.literal(dense<9.9999999999999995E-7> : tensor<f64>) : !torch.vtensor<[],f64>
%2 = torch.vtensor.literal(dense<1.000000e-05> : tensor<f64>) : !torch.vtensor<[],f64>
%3 = torch.vtensor.literal(dense<160> : tensor<si64>) : !torch.vtensor<[],si64>
%4 = torch.vtensor.literal(dense<-9.2103403719761836> : tensor<f64>) : !torch.vtensor<[],f64>
%5 = torch.vtensor.literal(dense_resource<__elided__> : tensor<1280x320xf32>) : !torch.vtensor<[1280,320],f32>
%6 = torch.vtensor.literal(dense_resource<__elided__> : tensor<320x4x3x3xf32>) : !torch.vtensor<[320,4,3,3],f32>
%7 = torch.vtensor.literal(dense_resource<__elided__> : tensor<640x320x3x3xf32>) : !torch.vtensor<[640,320,3,3],f32>
This file has been truncated, but you can view the full file.
#map0 = affine_map<(d0) -> (0)>
#map1 = affine_map<(d0) -> (d0)>
#map2 = affine_map<(d0) -> ()>
#map3 = affine_map<() -> ()>
#map4 = affine_map<(d0, d1) -> ()>
#map5 = affine_map<(d0, d1) -> (d0, d1)>
#map6 = affine_map<(d0, d1) -> (d0, 0)>
#map7 = affine_map<(d0, d1) -> (0, d1)>
#map8 = affine_map<(d0, d1) -> (d1, d0)>
#map9 = affine_map<(d0, d1) -> (d1)>
module attributes {torch.debug_module_name = "_lambda"} {
func.func @forward(%arg0: !torch.vtensor<[1,4,64,64],f16>, %arg1: !torch.vtensor<[1],f16>, %arg2: !torch.vtensor<[2,77,768],f16>, %arg3: !torch.vtensor<[],f32>) -> !torch.vtensor<[1,4,64,64],f16> {
%int64 = torch.constant.int 64
%int320 = torch.constant.int 320
%int2 = torch.constant.int 2
%int40960 = torch.constant.int 40960
%int4096 = torch.constant.int 4096
%int10 = torch.constant.int 10
%int32 = torch.constant.int 32
%int640 = torch.constant.int 640
This file has been truncated, but you can view the full file.
#map0 = affine_map<() -> ()>
#map1 = affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
#map2 = affine_map<(d0, d1, d2, d3) -> ()>
#map3 = affine_map<(d0) -> (0)>
#map4 = affine_map<(d0) -> (d0)>
#map5 = affine_map<(d0) -> ()>
#map6 = affine_map<(d0, d1) -> ()>
#map7 = affine_map<(d0, d1) -> (d0, d1)>
#map8 = affine_map<(d0, d1) -> (d0, 0)>
#map9 = affine_map<(d0, d1) -> (0, d1)>
from transformers import CLIPTextModel, CLIPTokenizer
from diffusers import AutoencoderKL, UNet2DConditionModel, PNDMScheduler
import torch
from PIL import Image
from diffusers import LMSDiscreteScheduler
from tqdm.auto import tqdm
from shark.shark_inference import SharkInference
from torch.fx.experimental.proxy_tensor import make_fx
from torch._decomp import get_decompositions
import torch_mlir
This file has been truncated, but you can view the full file.
#map0 = affine_map<(d0) -> (0)>
#map1 = affine_map<(d0) -> (d0)>
#map2 = affine_map<(d0) -> ()>
#map3 = affine_map<() -> ()>
#map4 = affine_map<(d0, d1) -> ()>
#map5 = affine_map<(d0, d1) -> (d0, d1)>
#map6 = affine_map<(d0, d1) -> (d0, 0)>
#map7 = affine_map<(d0, d1) -> (0, d1)>
#map8 = affine_map<(d0, d1) -> (d1, d0)>
#map9 = affine_map<(d0, d1) -> (d1)>
This file has been truncated, but you can view the full file.
#loc0 = loc(unknown)
module attributes {torch.debug_module_name = "_lambda"} {
func.func @forward(%arg0: !torch.vtensor<[2,4,64,64],f16> loc(unknown), %arg1: !torch.vtensor<[],si64> loc(unknown), %arg2: !torch.vtensor<[2,77,768],f16> loc(unknown)) -> !torch.vtensor<[2,4,64,64],f16> {
%int64 = torch.constant.int 64 loc(#loc1)
%int320 = torch.constant.int 320 loc(#loc1)
%int2 = torch.constant.int 2 loc(#loc1)
%int40960 = torch.constant.int 40960 loc(#loc1)
%int4096 = torch.constant.int 4096 loc(#loc1)
%int10 = torch.constant.int 10 loc(#loc1)
%int32 = torch.constant.int 32 loc(#loc1)
#map0 = affine_map<(d0, d1) -> (d0, d1)>
#map1 = affine_map<(d0, d1) -> (d1, d0)>
#map2 = affine_map<(d0, d1) -> (d1)>
#map3 = affine_map<(d0, d1, d2) -> (d0, d1, d2)>
module {
func.func @forward(%arg0: tensor<2x4096x320xf16>, %arg1: tensor<2x4096x320xf16>) -> tensor<2x4096x320xf16> {
%cst = arith.constant 0.000000e+00 : f16
%cst_0 = arith.constant 0.000000e+00 : f16
%0 = tensor.empty() : tensor<2x4096x320xf16>
%1 = linalg.fill ins(%cst : f16) outs(%0 : tensor<2x4096x320xf16>) -> tensor<2x4096x320xf16>
stable_diff_f16_elided.mlir:1730:12: error: failed to legalize operation 'vector.transfer_read' that was explicitly marked illegal
%261 = linalg.generic {indexing_maps = [#map16, #map16, #map16], iterator_types = ["parallel", "parallel", "parallel"]} ins(%expanded_770, %209 : tensor<2x4096x320xf16>, tensor<2x4096x320xf16>) outs(%156 : tensor<2x4096x320xf16>) {
^
stable_diff_f16_elided.mlir:25:3: note: called from
func.func @forward(%arg0: tensor<2x4x64x64xf16>, %arg1: tensor<1xf16>, %arg2: tensor<2x77x768xf16>) -> tensor<2x4x64x64xf16> {
^
stable_diff_f16_elided.mlir:1730:12: note: see current operation: %710 = "vector.transfer_read"(%58, %709, %45) {in_bounds = [true], operand_segment_sizes = array<i32: 1, 1, 1, 0>, permutation_map = affine_map<(d0) -> (d0)>} : (memref<320xf16>, index, f16) -> vector<16xf16> loc(callsite("stable_diff_f16_elided.mlir":1730:12 at "stable_diff_f16_elided.mlir":25:3))
%261 = linalg.generic {indexing_maps = [#map16, #map16, #map16], iterator_types = ["paral