Skip to content

CudaKernel Object Fusion unique_ptr cleanup #175

@kevinstephano

Description

@kevinstephano

🚀 Feature

It was noted the the weirdness of combining the Fusion IR creation and the CudaKernel object creation as they are two separate events and a CudaKernel doesn't necessarily have to be generated.

A common pattern in tests is:

  torch::jit::fuser::cuda::CudaKernel prog;      
  prog.setFusionPtr(std::make_unique<Fusion>());
  Fusion* fusion = prog.fusion();
  FusionGuard fg(fusion);

It would be better to have:

  auto fusion = std::make_unique<Fusion>();
  FusionGuard fg(fusion.get());

  <sometime later>

  //At kernel Generation time.
  torch::jit::fuser::cuda::CudaKernel prog(std::move(fusion));

This requires modifying the CudaKernel Object declaration in kernel_cache.h to include an explicit constructor that takes a unique_ptr.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions