As learning models continue to scale aggressively, compiling a machine learning application to a non-volatile memory (NVM)-based neuromorphic hardware is becoming increasingly challenging. This talk will introduce nc2, a LLVM-based compiler for neuromorphic hardware designed with NVM synapses. Fundamental to this compiler is a novel unrolling technique, which decomposes a neuron function with large number of pre-synaptic connections into a sequence of homogeneous neural units, where each neural unit is a function computation node, accommodating up to two pre-synaptic connections. The unrolling technique ensures information integrity, resulting in no loss of model quality such as accuracy. Next, the unrolled machine learning model is partitioned into clusters, such that a cluster can fit onto a computation unit (e.g., crossbar) in the hardware, improving utilization of the crossbar’s resources and reducing wasted energy. Finally, clusters are intelligently allocated to the hardware, reducing the performance bottleneck in time sharing the computation units.