Validate Tensor Shape and Layout Before Compiler Lowering

Quick Overview

Design compiler IR checks for tensor shape and layout consistency before lowering, with dynamic-dimension handling, pass-boundary validation, and precise diagnostics.

Validate Tensor Shape and Layout Before Compiler Lowering

Company: Amazon

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Technical Screen

A compiler repeatedly discovers structural problems only during accelerator runtime. Propose static checks on its intermediate representation (IR), focusing on tensor-shape and data-layout consistency before later transformations and low-level code generation. ### Clarifying Questions to Ask - Which shape/layout properties are statically known and which are dynamic? - Which transformations can change those properties after the initial check? - What evidence links the runtime failures to specific violated IR invariants? ```hint Check at the boundary where an invariant is promised One early check is insufficient if a later transformation can invalidate the same property. ``` ### What a Strong Answer Covers - Concrete shape/layout invariants and source-local diagnostics. - Handling unknown dynamic dimensions without falsely rejecting valid programs. - Validation before lowering and after invariant-changing passes. ### Follow-up Questions - How would you test that a verifier catches the original failures without rejecting valid dynamic shapes? - What evidence would support a claimed memory reduction caused by this work?

Overview: Design compiler IR checks for tensor shape and layout consistency before lowering, with dynamic-dimension handling, pass-boundary validation, and precise diagnostics.

Amazon logo
Amazon
Nov 16, 2026
hardSoftware EngineerTechnical ScreenSoftware Engineering Fundamentals
0
0

A compiler repeatedly discovers structural problems only during accelerator runtime. Propose static checks on its intermediate representation (IR), focusing on tensor-shape and data-layout consistency before later transformations and low-level code generation.

Clarifying Questions to Ask Guidance

  • Which shape/layout properties are statically known and which are dynamic?
  • Which transformations can change those properties after the initial check?
  • What evidence links the runtime failures to specific violated IR invariants?

What a Strong Answer Covers Guidance

  • Concrete shape/layout invariants and source-local diagnostics.
  • Handling unknown dynamic dimensions without falsely rejecting valid programs.
  • Validation before lowering and after invariant-changing passes.

Follow-up Questions Guidance

  • How would you test that a verifier catches the original failures without rejecting valid dynamic shapes?
  • What evidence would support a claimed memory reduction caused by this work?