refactor compile and add amd