Skip to content

Running functions torch.compiled with inductor segfaults when torchvision==0.14.1 is also installed #93019

@soulitzer

Description

@soulitzer

🐛 Describe the bug

Repro: installing torchvision==0.14.1 (make sure pillow is also installed) and run the following

import torch
import torch._dynamo

def ones():
  return torch.ones([4], device="cuda")

ten = torch.rand([4], device="cuda")
foo1 = lambda x: x + ten
foo2 = lambda x: x + ten.sum()

fn1 = lambda: foo1(ones())
fn2 = lambda: foo2(ones())

fn2_opt = torch._dynamo.optimize("inductor")(fn2)
fn1_opt = torch._dynamo.optimize("inductor")(fn1)
# Maybe not important, but switching the order of calling fn1_opt(), fn2_opt() below no longer segfaults
fn1_opt()
fn2_opt()

Not having torchvision installed or having a torchvision from source is OK.

Maybe I shouldn't expect torch from source to work with an older torchvision, but the repro doesn't even involve torchvision. I ran into this issue when running python benchmarks/dynamo/timm_models.py which installed torchvision==0.14.1 (the latest released version) for me.

Versions

From source

cc @ezyang @soumith @msaroufim @wconstab @ngimel @bdhirsh @mlazos @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @chunyuan-w @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @desertfire

Metadata

Metadata

Assignees

Labels

module: crashProblem manifests as a hard crash, as opposed to a RuntimeErrormodule: inductoroncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions