Disclosed are novel heteroaryl and heterocycle compounds of formula I-1, I-2 or I-3 and pharmaceutical compositions comprising them, uses and methods thereof for inhibiting the activity of PI3K and for treating inflammatory and autoimmune diseases and cancer.