How variable spilling works
Compiler Engineer Interview Questions
187 compiler engineer interview questions shared by candidates
What is polymorphism?
My Background: I worked in compiler frontend (Clang) during my thesis developing a compiler like tool for static analysis of C language. Basically a linter for C programming language. Hiring Manager Round: He worked in GPU compiler optimization team at NVIDIA. Talked about stuff he does related to compiler optimizations. Asked questions about compiler optimizations like loop optimizations and peephole optimizations since I knew he is from optimization team I prepared these stuff in advance. But I clearly told him that I have never worked in optimizations field. Note: Compiler optimization is compiler backend where you also need architecture related knowledge. First Round[Coding] : Q1: Print all the permutations of string? I told him to change the question since I didn’t revise backtracking for this interview. He was humble enough to change the question. Q2: Merge sort on linked list with detailed runtime analysis? I answered the question successfully but made mistake in analysing the runtime. I implemented the approach of dividing the linked list in two halves and merging the two halves and recursively applying quicksort I told him it is O(n^2) which was wrong. But even he didn’t knew that I made a mistake in analysis and he kept on suggesting a method to reduce it to O(nlogn) which was wrong. Q3: How to implement hashmap? Possible approaches in defining the hash function for mapping keys? Second round [Coding] : Q1: Find min element in a binary tree? Q2: C code to extract words from a sentence and copying it to 2d array where each row contains a word. The code was a little complex. There he was copying the strings by breaking the whole sentence and also memory manipulation with realloc was done to handle the case of insufficient memory if the allocated memory is less than allocated earlier. E.g: I/p: Nvidia is a cool organization. O/p: Nvidia is a cool organization Q3: There is a 3x3 matrix of storing apps like A1 A2 A3 A4 A5 A6 A7 A8 A9 You need to maintain top 9 apps in this matrix. How will you do it? Now he didn’t mention anything apart from this. I didn’t ask him any questions and moved forward with the solution which was a mistake. I said I will do it using priority queue. Then he said how priority queue will work so I explained him insertion and deletion of node in heap for 20 mins then he said ohh but it will not be maintaining the order right? I was like whattt. He said can you think of other data structures for this? Then again after thinking for 10 mins I said I will store it using linked list and map. Basically it is Implement LRU cache standard problem. Which I saw a day back but couldn’t think about it at the actual moment. I told him how I will implement it and he didn’t ask me to code it and this interview was done. Third Round [Design Skills]: Q1: How do you reduce the cache misses in case of multiplying of 2 very large matrices? I couldn’t answer it since I had no idea how cache will work in this case. Q2: Then he asked a long cryptic compiler related problem. It goes like this…. Lets say compiler A calls compiler B’s “invoke” module 15 times and during that it performs some steps where the percentage of time consumed is written alongside Initializing a compiler instance 15% Preprocessing 25% Syntax analysis 25% Optimizations 35% How will you minimize the time consumed? Now what do you get by this problem? Do I need to make 15% to 10%? What is the meaning of reducing the time? It took me 25 mins to clarify the problem from the interviewer. Basically he wanted to know like do we need to initialize the compiler instance for all 15 calls or do we need to perform preprocessing again and again or not? So after I finally understood the problem I answered all his questions successfully. I told him we can have an if check if the compiler is already initialized. We can pass the argument to the invoke function to take the compiler instance. We can store a map to store the preprocessor related data and can use flags to know if syntax analysis was done already or not then he asked followup like can we remove if conditions then I said like checking the map size and stuff. So basically I handled his questions well. Fourth round [Clang knowledge]: This was the most sensible interview. She asked me all the details about my project and how I approached the problem and what data structures and design patterns I used for it. So basically she was interested in the work and since I did my project really well I knew each and every stuff she asked me regarding it. Compiler Director Round [Cultural Fit]: He asked questions about my project and some things like why do you want to join this difficult and boring field. Basically after his demotivation I decided I don’t want to join this field. After a week
Making a working, efficient solution to Leetcode "Hard" problems in under 10 minutes
1. how to achieve SSA form in the compiler? 2. what is the lvalue of C++?
Code Analysis - C code involving function pointers and string manipulation
a concrete IR example, how would the compiler to perform most aggresive optimization. what are the tradeoffs
Describe a challenge you encountered in a previous project and how you approached it.
How does the DNS work?
I remember only 1 question, and that was course scheduler leetcode task.
Viewing 81 - 90 interview questions