Patent ID: 7533236

Claim:
A method of allocating memory for processing threads in a multithreaded processor to execute a shader program, comprising: receiving a thread launch request for a first thread; determining that the first thread requires a memory allocation to execute the shader program in the multithreaded processor; obtaining an available memory offset specifying an allocation unit within a memory pool allocated for processing the threads, wherein a size of the allocation unit is based on a largest amount of memory needed by any thread to execute the shader program in the multithreaded processor; writing the available memory offset in an entry of a thread table to allocate the allocation unit within the memory pool to the first thread; and wherein the obtaining of the available memory offset comprises reading a thread counter and determining whether or not the thread counter equals a maximum number of threads sharing the memory pool; reading a memory offset counter to obtain the available memory offset when all of the threads are not allocated; and incrementing the thread counter by one; and updating the memory offset counter by increasing the memory offset counter by the size of the allocation unit.