This is a more complicated question that it seems!
Cookie banner are not directly related to the GDPR, but to the Eprivacy directive, which, not being a Regulation, is subject to variation in national law transcription. So the answer may vary depending on your country!
Still in an effort to have a uniform position on the question, DPAs( Data protection agency) are working at the EDPB (the European Data Protection Board, a sort of council of DPAs) to have a common position.
One of the currently shared position is that a cookie wall impedes the "free" part of the consent, since you have to support a negative consequence.
In a communication regarding the (future?) Eprivacy regulation, the EDPB clearly stated that:
"In order for consent to be freely given as required by the GDPR, access to services and functionalities must not be made conditional on theconsentof a userto the processing of personal data or the processing of information related to or processed by the terminal equipment of end-users, meaning that cookie walls should be explicitly prohibited." [1]
If I remember correctly the Austria DPA is not of favor of a cookie wall ban though..
From memory, not a legal advice!
EDIT: try to make the explanation clearer!
[1]: https://edpb.europa.eu/sites/edpb/files/files/file1/edpb_sta...