How to properly use packed 2D arrays as input and outputs of verilog task?
You need to be using SystemVerilog to have unpacked arrays as arguments to a task. And the task as you have written it does not do the same thing as the code without the task. That is because the output array A is uninitialized and you are only setting the value indexed by x1.