1. A cross thread scheduling method for compiling code, the method comprising: scheduling the scheduling unit with a cross-thread scheduler sub-operation in response to the scheduling unit being in a multithreaded part of the code, wherein the cross-thread scheduler sub-operation includes instructions to: while there are unscheduled ops, iteratively performing: identify a plurality of operations that are ready to be scheduled in the cycle, wherein the plurality of operations includes operations whose input are ready in the cycle, operations whose consumed resource are available in the cycle, and operations whose input are nearly ready to be scheduled; identify one operation of the plurality of operations that at least one of contributes to a critical path and uses a critical resource, assign priority to operations that alternate a resource usage pattern; assign the one operation to a current scheduling time; and update available resources for current scheduling time.