NVIDIA186 open jobs

Senior Compiler Optimization Engineer – LLVM

Systems, C++ and performancePosted over 2 months agofrom NVIDIA's own hiring page

Work type
On-siteBengaluru, Pune
Experience
8+ years
Pay
Not listed
Posted
Over 2 months agoOpen 2 months
Before you apply: make your resume fit this job

Skills it mentions

Add your skills to see which ones you have.

Interview questions for this job6 with answers below, on Deep learning, C and C++

About the job

We are looking to hire a Senior LLVM Compiler Engineer for an exciting role developing compilers for our world leading GPUs. We craft outstanding compilers that realize the potential of NVIDIA GPU hardware for growing range of computational workloads, ranging from next generate graphics, deep learning, scientific computing, and self-driving cars. Our compiler organization makes its mark on every GPU and SoC product that NVIDIA builds. Would you like to be part of this best-in-class organization and lead the charge?

What you'll be doing:

  • Be part of NVIDIA re-targetable GPU compiler backend team

  • Work on challenging problems in register allocation, instruction scheduling, synchronization, loop optimizations etc.

  • Develop innovative solutions to optimize workloads in Deep Learning, Ray Tracing, HPC etc. by working with industry experts in each field.

  • Solve unique problems seen only in a compiling for massively parallel GPU architecture.

  • Get a chance to influence and work on new GPU architectures.

What we need to see:

  • B.S. or higher degree in Computer Science/Engineering

  • Proficient in compiler design with 8+ years of experience

  • Strong background in program analysis and high level optimizations

  • Excellent C and C++ programming skills

  • Hands on experience in compiler infrastructures like LLVM/GCC

  • Good understanding of processor architecture

  • Experience in a working in a global team

  • Self-motivated to get things done

  • Good communication skills with ability to influence others

Ways to stand out from the crowd:

  • Masters or PhD preferred

  • Demonstrated ability to pursue complex optimization problems

  • Experience in Scheduling/Register Allocation

  • Experience in developing CUDA, DirectX, OpenGL/Vulkan applications

NVIDIA is widely considered to be one of the technology world’s most desirable employers. We have some of the most forward-thinking and hardworking people in the world working for us. If you are creative and autonomous, we want to hear from you.

NVIDIA is committed to developing a diverse work environment and proud to be an equal opportunity employer. As we highly value diversity in our current and future employees, we do not discriminate (including in our hiring and promotion practices) on the basis of race, religion, color, national origin, gender, gender expression, sexual orientation, age, marital status, veteran status, disability status or any other characteristic protected by law.

Interested?Senior Compiler Optimization Engineer – LLVM at NVIDIA

Apply on company site (opens in a new tab)

The job ad ends here

Interview questions for this job6 with answers, on Deep learning, C and C++

Interview questions for this job

For the skills the ad mentions: Deep learning, C and C++.

81 questions
  • What is the use of verbose in Keras while validating the model?Deep learning

    Check documentation for model.fit here.

    By setting verbose 0, 1 or 2 you just say how do you want to 'see' the training progress for each epoch.

    verbose=0 will show you nothing (silent)

    verbose=1 will show you an animated progress bar like this:

    verbose=2 will just mention the number of epoch like this:

    From Stack Overflow: asked by rakesh, answered by Ankit (CC BY-SA 4.0)

  • Why use apparently meaningless do-while and if-else statements in macros?C

    The do ... while and if ... else are there to make it so that a semicolon after your macro always means the same thing. Let's say you had something like your second macro.

    #define BAR(X) f(x); g(x)
    

    Now if you were to use BAR(X); in an if ... else statement, where the bodies of the if statement were not wrapped in curly brackets, you'd get a bad surprise.

    if (corge)
      BAR(corge);
    else
      gralt();
    

    The above code would expand into

    if (corge)
      f(corge); g(corge);
    else
      gralt();
    

    which is syntactically incorrect, as the else is no longer associated with the if. It doesn't help to wrap things in curly braces within the macro, because a semicolon after the braces is syntactically incorrect.

    if (corge)
      {f(corge); g(corge);};
    else
      gralt();
    

    There are two ways of fixing the problem. The first is to use a comma to sequence statements within the macro without robbing it of its ability to act like an expression.

    #define BAR(X) f(X), g(X)
    

    The above version of bar BAR expands the above code into what follows, which is syntactically correct.

    if (corge)
      f(corge), g(corge);
    else
      gralt();
    

    This doesn't work if instead of f(X) you have a more complicated body of code that needs to go in its own block, say for example to declare local variables. In the most general case the solution is to use something like do ... while to cause the macro to be a single statement that takes a semicolon without confusion.

    #define BAR(X) do { \
      int i = f(X); \
      if (i > 4) g(i); \
    } while (0)
    

    You don't have to use do ... while, you could cook up something with if ... else as well, although when if ... else expands inside of an if ... else it leads to a "dangling else", which could make an existing dangling else problem even harder to find, as in the following code.

    if (corge)
      if (1) { f(corge); g(corge); } else;
    else
      gralt();
    

    The point is to use up the semicolon in contexts where a dangling semicolon is erroneous. Of course, it could (and probably should) be argued at this point that it would be better to declare BAR as an actual function, not a macro.

    In summary, the do ... while is there to work around the shortcomings of the C preprocessor. When those C style guides tell you to lay off the C preprocessor, this is the kind of thing they're worried about.

    From Stack Overflow: asked by jfm3, answered by jfm3 (CC BY-SA 4.0)

  • What is The Rule of Three?C++

    Introduction

    C++ treats variables of user-defined types with value semantics. This means that objects are implicitly copied in various contexts, and we should understand what "copying an object" actually means.

    Let us consider a simple example:

    class person
    {
        std::string name;
        int age;
    public:
        person(const std::string& name, int age) : name(name), age(age)
        {
        }
    };
    int main()
    {
        person a("Bjarne Stroustrup", 60);
        person b(a);   // What happens here?
        b = a;         // And here?
    }
    

    (If you are puzzled by the name(name), age(age) part, this is called a member initializer list.)

    Special member functions

    What does it mean to copy a person object? The main function shows two distinct copying scenarios. The initialization person b(a); is performed by the copy constructor. Its job is to construct a fresh object based on the state of an existing object. The assignment b = a is performed by the copy assignment operator. Its job is generally a little more complicated because the target object is already in some valid state that needs to be dealt with.

    Since we declared neither the copy constructor nor the assignment operator (nor the destructor) ourselves, these are implicitly defined for us. Quote from the standard:

    The [...] copy constructor and copy assignment operator, [...] and destructor are special member functions. [ Note: The implementation will implicitly declare these member functions for some class types when the program does not explicitly declare them. The implementation will implicitly define them if they are used. [...] end note ] [n3126.pdf section 12 §1]

    By default, copying an object means copying its members:

    The implicitly-defined copy constructor for a non-union class X performs a memberwise copy of its subobjects. [n3126.pdf section 12.8 §16]

    The implicitly-defined copy assignment operator for a non-union class X performs memberwise copy assignment of its subobjects. [n3126.pdf section 12.8 §30]

    Implicit definitions

    The implicitly-defined special member functions for person look like this:

    // 1. copy constructor
    person(const person& that) : name(that.name), age(that.age)
    {
    }
    // 2. copy assignment operator
    person& operator=(const person& that)
    {
        name = that.name;
        age = that.age;
        return *this;
    }
    // 3. destructor
    ~person()
    {
    }
    

    Memberwise copying is exactly what we want in this case: name and age are copied, so we get a self-contained, independent person object. The implicitly-defined destructor is always empty. This is also fine in this case since we did not acquire any resources in the constructor. The members' destructors are implicitly called after the person destructor is finished:

    After executing the body of the destructor and destroying any automatic objects allocated within the body, a destructor for class X calls the destructors for X's direct [...] members [n3126.pdf 12.4 §6]

    Managing resources

    So when should we declare those special member functions explicitly? When our class manages a resource, that is, when an object of the class is responsible for that resource. That usually means the resource is acquired in the constructor (or passed into the constructor) and released in the destructor.

    Let us go back in time to pre-standard C++. There was no such thing as std::string, and programmers were in love with pointers. The person class might have looked like this:

    Read the rest at the sourceFrom Stack Overflow: asked by fredoverflow, answered by fredoverflow (CC BY-SA 4.0)

  • Why do we "pack" the sequences in PyTorch?Deep learning

    I have stumbled upon this problem too and below is what I figured out.

    When training RNN (LSTM or GRU or vanilla-RNN), it is difficult to batch the variable length sequences. For example: if the length of sequences in a size 8 batch is [4,6,8,5,4,3,7,8], you will pad all the sequences and that will result in 8 sequences of length 8. You would end up doing 64 computations (8x8), but you needed to do only 45 computations. Moreover, if you wanted to do something fancy like using a bidirectional-RNN, it would be harder to do batch computations just by padding and you might end up doing more computations than required.

    Instead, PyTorch allows us to pack the sequence, internally packed sequence is a tuple of two lists. One contains the elements of sequences. Elements are interleaved by time steps (see example below) and other contains the size of each sequence the batch size at each step. This is helpful in recovering the actual sequences as well as telling RNN what is the batch size at each time step. This has been pointed by @Aerin. This can be passed to RNN and it will internally optimize the computations.

    I might have been unclear at some points, so let me know and I can add more explanations.

    Here's a code example:

     a = [torch.tensor([1,2,3]), torch.tensor([3,4])]
     b = torch.nn.utils.rnn.pad_sequence(a, batch_first=True)
     >>>>
     tensor([[ 1,  2,  3],
        [ 3,  4,  0]])
     torch.nn.utils.rnn.pack_padded_sequence(b, batch_first=True, lengths=[3,2])
     >>>>PackedSequence(data=tensor([ 1,  3,  2,  4,  3]), batch_sizes=tensor([ 2,  2,  1]))
    

    From Stack Overflow: asked by aerin, answered by Umang Gupta (CC BY-SA 4.0)

  • What is the strict aliasing rule?C

    A typical situation where you encounter strict aliasing problems is when overlaying a struct (like a device/network message) onto a buffer of the word size of your system (like a pointer to uint32_ts or uint16_ts). When you overlay a struct onto such a buffer, or a buffer onto such a struct through pointer casting you can easily violate strict aliasing rules.

    So in this kind of setup, if I want to send a message to something I'd have to have two incompatible pointers pointing to the same chunk of memory. I might then naively code something like this:

    #include <stdint.h>
    #include <stdlib.h>
    #include <stdio.h>
    typedef struct Msg {
        uint32_t a;
        uint32_t b;
    } Msg;
    // Sends a buffer over a 16-bit channel
    void SendWords(uint16_t *buf, size_t sz) {
        for(size_t i = 0; i < sz; ++i)
            printf("%.4x ", buf[i]);
        printf("\n");
    }
    int main(void) {
        Msg msg;
        // Send a bunch of messages
        for(int i = 0; i < 10; ++i) {
            msg.a = 0xDEADBEEF;
            msg.b = i;
            SendWords((uint16_t*)&msg, sizeof(msg)/sizeof(uint16_t));
        }
    }
    

    The strict aliasing rule makes this setup illegal: dereferencing a pointer that aliases an object that is not of a compatible type or one of the other types allowed by C 2011 6.5 paragraph 71 is undefined behavior. Unfortunately, you can still code this way, maybe get some warnings, have it compile fine, only to have weird unexpected behavior when you run the code. For example, when I compiled it with gcc -O2 it produced this very unexpected output:

    0000 0000 0000 0000
    0000 0000 0000 0000
    0000 0000 0000 0000
    ...
    

    See this snippet on Compiler Explorer for how GCC and Clang both produce different unintended outputs.

    To see why this behavior is undefined, we have to think about what the strict aliasing rule buys the compiler. Following this rule, the writes to msg cannot alias the reads of buf in SendWords. Consequently, an optimizing compiler can reorder the instructions, so that all assignments to msg happen before or after all the reads from buf in SendWords. In turn, it can then deduce that buf[0], ..., buf[3] can be loaded from memory before the loop is executed, or that only the msg values from the last iteration of the loop need to be calculated. Either way, removing the redundant stores and loads (under this rule) makes the generated code faster. Before strict aliasing was introduced, the compiler had to live in a state of paranoia that the contents of buf could change by any preceding memory stores. So to get an extra performance edge, and assuming most people don't type-pun pointers, the strict aliasing rule was introduced.

    So how do I get around this?

    Read the rest at the sourceFrom Stack Overflow: asked by Benoit, answered by Doug T. (CC BY-SA 4.0)

  • What are your main strengths?Behavioural

    The strengths employers look for will depend on the job role. They may ask you questions like:

    • what are your main strengths?
    • why should we hire you?

    You can use specific examples to highlight your strengths, such as:

    • communication - to show you get on with others
    • problem solving - to show that you can find solutions
    • enthusiasm - to show that you have a positive attitude to work
    • flexibility - to show that you can adapt to different ways of working

    Plan your answers around 2 or 3 examples that are relevant to the job. You can back these up with qualifications or training you've done.

    From National Careers Service: interview advice (Open Government Licence v3.0)

Similar jobs

More like this: C++ and systems jobs in Bengaluru (91), Jobs in Bengaluru (10,735) and C++ and systems jobs in India (161)