AVX-512 and Branching
问题 I'm confused as to what masking can do in theory in relation to branches. Let's say I have a Skylake-SP (ha, I wish..), and we're ignoring compiler capabilities, just what's possible in theory: If a branch conditional is dependant on a static flag, and all branches set an array to a computational result, assuming the compiler does not optimize this to two separate loops anyways , can it vectorize? do i = 1, nx if (my_flag .eq. 0) then a(i) = b(i) ** 2 else a(i) = b(i) ** 3 end if end do If